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

 and since the schema.org context already defines "id": "@id" and
"type": "@type", we can just omit the "@"s with no further changes.

& for my 2c I'd also rather see DataRecord dropped :-)


---
Carl Boettiger
http://carlboettiger.info/

On Wed, Nov 21, 2018 at 9:14 AM Chris Mungall <cjmungall@lbl.gov> wrote:
>
> This is partly a matter of personal preference, but I strongly prefer relegating all "@"s to the context and using shorthands like "id" and "type" in the body.
>
> On 21 Nov 2018, at 7:54, Melanie Courtot wrote:
>
> Thanks both, that looks much more straighforward. I see that the identifier property from bioschema in my original snippet,  "identifier": "biosample:SAMEA100000”, as also been rewritten using @id - shouldn’t we expand the biosample prefix in the context as well then? The final version would then be:
>
> {
>  "@context": [ "http://schema.org",
>  {
>    "OBI" :"http://purl.obolibrary.org/obo/OBI_”
>    “biosample":”http://identifiers.org/biosample"
>  }],
>  "@type": "DataRecord",
>  "@id": "biosample:SAMEA100000",
>  "mainEntity": {
>    "@type" : ["Sample","OBI:0000747"]
>  }
> }
>
>
> I’m still unclear about the notation  "@context": "http://schema.org” - is that the default context for anything not otherwise bound to a prefix?
>
> Is there a difference between @context": "http://schema.org” and
> "@context":{
>         "@base": "http://schema.org",
>     }
> As said I couldn’t find an explanation for the syntax "@context": "http://schema.org” in the json-ld spec at https://www.w3.org/TR/json-ld/#the-context
>
>
>
> Finally  (and that’s maybe Jerven feels about strongly as well, given the edits to the subject line ;)): we now have a DataRecord with ID as well as the mainEntity of the page with the same ID.
>
>   "mainEntity": {
>     "@id": ""biosample:SAMEA100000",
>
>
> Should we use @id in the data Record as the actual URL of the biosamples page we are referring to, i.e., https://www.ebi.ac.uk/biosamples/samples/SAMEA100000, and the the ID of the mainEntity is the identifiers.org “canonical” IRI for this sample?  It seems a little bit circular to be honest. We may be better off saying this is a dataRecord with  "@id": "biosample:SAMEA100000” and then not have an ID for the mainEntity? Or is the circularity not a problem?
>
> Thanks again for the help,
> Melanie
>
>
>
>
>
> On 21 Nov 2018, at 15:26, Jerven Bolleman <jerven.bolleman@sib.swiss> wrote:
>
> Hi Melanie, Leyla,
>
> I see the error in my reply.
>
> You want to say the anonymous mainEntity is a schema:Sample and a OBI:0000747 at the same time.
> Then you want to use this
> {
>  "@context": [ "http://schema.org",
>  {
>    "OBI" :"http://purl.obolibrary.org/obo/OBI_"
>  }],
>  "@type": "DataRecord",
>  "@id": "biosample:SAMEA100000",
>  "mainEntity": {
>    "@type" : ["Sample","OBI:0000747"]
>  }
> }
>
> There may be or may not be a file somewhere that relates the schema;Sample to OBI:0000747 in some way in the future but this is not expressible in a context in JSON-LD (not now in 1.0 nor in 1.1)
>
> Regards,
> Jerven
> On 11/21/2018 03:45 PM, ljgarcia wrote:
>
> 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 17:26:51 UTC