Re: JSON-LD and context questions (plus no additionalType and I don't like DataRecord)

Hi Melanie,

I do not see why you would need the second local context in your 
example.

Now, regarding http://purl.obolibrary.org/obo/OBI_0000747. Are you 
trying to express that schema:Sample is somehow "inspired/based" on 
http://purl.obolibrary.org/obo/OBI_0000747? If yes, you do not need to 
add it here. That will be expressed somehow as part of the Sample 
definition is schema.org. The "somehow" way to express it, I think has 
not been agreed yet, it would be a property such as "baseOn", 
"equivalentTo" or so.

Kind regards,

On 2018-11-21 14:00, Jerven Bolleman wrote:
> Hi Melanie,
> 
> I think you want to do this.
> 
> {
>   "@context": [ "http://schema.org",
>               {
>                 "OBI" :"http://purl.obolibrary.org/obo/OBI_"
>               }
>   ],
>   "@type": "DataRecord",
>   "@id": "biosample:SAMEA100000",
>   "mainEntity": {
>     "@type" : "OBI:0000747"
>   }
> }
> 
> Here we start with merging two contexts. The standard schema.org and
> one just for your file. Here trying to make the OBI one easier to
> read.
> 
> So your top level is a DataRecord linked via schema:mainEntity to
> something with type "OBI:0000747".
> 
> You can see what a JSON-LD snipit means in RDF at
> https://json-ld.org/playground/ e.g. http://tinyurl.com/y9ccen2j
> 
> 
> I am repeating myself here but in additionalType is only for the
> MicroData serialization which no one in the bioschema space seems to
> use.
> 
> If you have more than one type just do
> 
> {
>   "@context": [ "http://schema.org",
>               {
>                 "OBI" :"http://purl.obolibrary.org/obo/OBI_"
>               }
>   ],
>   "@type": [ "DataRecord", "Thing", "WebPage" ],
>   "@id": "biosample:SAMEA100000",
>   "mainEntity": {
>     "@type" : "OBI:0000747"
>   }
> }
> 
> To be honest I don't like the DataRecord at all and am still
> advocating it's removal from bioschema. Mostly because schema.org
> doesn't have StoreRecord, just Store.
> 
> Regards,
> Jerven
> 
> PS Alasdair, Leyla maybe remove additionalType considering the
> confusion it has generated and we have no Microdata examples.
> 
> On 11/21/2018 02:40 PM, Melanie Courtot wrote:
>> Hi,
>> 
>> Hi - following up discussions at the BioHackathon we’re looking at 
>> updating our sample serialisation. We are running into some questions 
>> with respect to the context usage and are hoping someone can help.
>> 
>> Specifically, I’m trying to understand the usage of contexts and base 
>> IRIS - I’m familiar with XML base and namespaces as well as RDF, but I 
>> was looking at some schema.org <http://schema.org> JSON-LD and trying 
>> to understand nuances based on the official spec at 
>> https://www.w3.org/TR/json-ld/#the-context
>> 
>> Here is the relevant excerpt from our serialisation:
>> 
>> {
>>    "@context": "http://schema.org",
>>    "@type": "DataRecord",
>>    "identifier": "biosample:SAMEA100000",
>>    "mainEntity": {
>>      "@context": [
>>        "http://schema.org",
>>        {
>>          "@base": "http://schema.org"
>>        },
>>        {
>>          "Sample": {
>>            "@id": "http://purl.obolibrary.org/obo/OBI_0000747"
>>          }
>>        }
>>      ],
>> ….
>> 
>> 
>> As you can see there is a repetition of contexts and base that I don’t 
>> think is needed.
>> 
>> 1. The first context, which is at the top level in our sample page, 
>> seems to match example 4 from the spec, and would actually be a 
>> reference to another json-ld context? Though it doesn’t point to a 
>> json-ld file. I couldn’t find this specific notation anywhere else in 
>> the JSON-LD spec, but this is what is used throughout on schema.org 
>> <http://schema.org>, eg https://schema.org/Person, example 1 in 
>> json-ld.
>> 
>> 2. The whole page is a DataRecord (where DataRecord is a new type we 
>> are proposing to schema.org <http://schema.org>, so should expand to 
>> http://schema.org/DataRecord) - which is expected as we want to 
>> describe a data record in our resource, and we then describe the 
>> mainEntity in that DataRecord.
>> As you can see, the context is redefined in mainEntity - my 
>> understanding is that this means this specific context declaration 
>> will be valid only within the scope of that mainEntity. This context 
>> reads
>> 
>>      "@context": [
>>        "http://schema.org",
>>        {
>>          "@base": "http://schema.org"
>>        },
>> 
>> I don’t understand what the first "http://schema.org” means, and 
>> whether it’s needed as we explicitly define the base. Also this seems 
>> redundant with the global page context we have defined at the page 
>> level, so I’d be tempted to just have
>> 
>>      "@context": {
>>          "@base": "http://schema.org"
>>        },
>> 
>> At the top level.
>> 
>> 3. Finally, we are trying to say that http://schema.org/Sample (which 
>> is a new type we’re proposing) also has the IRI 
>> "http://purl.obolibrary.org/obo/OBI_0000747”. I’m not sure adding
>> 
>>        {
>>          "Sample": {
>>            "@id": "http://purl.obolibrary.org/obo/OBI_0000747"
>>          }
>> 
>> In the context is the right way of doing it, or whether we should just 
>> add an additionalType <https://schema.org/additionalType> property on 
>> the sample object later on - or should we do both?
>> 
>> Apologies for the rather long email, but I hope we have a JSON-LD 
>> specialist on this list that can provide some guidance as to how we 
>> should best use those. Thanks in advance for any help!
>> 
>> Cheers,
>> Melanie
>> 
>> 
>> 
>> 
>> -- Mélanie Courtot, PhD
>> GA4GH/BioSamples Project lead
>> European Bioinformatics Institute (EMBL-EBI)
>> 

Received on Wednesday, 21 November 2018 14:46:34 UTC