ropensci / emld

:package: JSON-LD representation of EML
https://docs.ropensci.org/emld
Other
13 stars 6 forks source link

Naturalize semantic annotations #2

Open cboettig opened 6 years ago

cboettig commented 6 years ago

Sounds like the next EML release should include extensions through semantic annotations, potentially something like:

<attribute id = "att.12">
       ...
        <annotation>
            <propertyURI>http://ecoinformatics.org/oboe/oboe.1.2/oboe-characteristics.owl#Characteristic</propertyURI>
            <termURI>http://ecoinformatics.org/oboe/oboe.1.2/oboe-characteristics.owl#Mass</termURI>
            <termLabel>Mass</termLabel>
        </annotation>

We would want a native JSON-LD translation to embed these directly in the natural linked data format. For example the above would simply be:

"attribute": {
  "@id": "att.12",
  "oboe:Characteristic": "oboe:Mass"
}

with "oboe": "http://ecoinformatics.org/oboe/oboe.1.2/oboe-characteristics.owl#" added to the JSON-LD @context (along with a context for native EML terms). Should probably get a @type element too.

In the case of oboe, looks like this may require some finessing of the namespace, since that's clearly just oboe-characteristics and not all of oboe at that address. Ideally this information will be in the EML, but maybe would need to be resolved by dereferencing the URIs.

A better JSON-LD entry would type the value appropriately as a UID instead of a text string:

"attribute": {
  "@id": "att.12",
  "oboe:Characteristic": {"@id: "oboe:Mass" },
   ...
}

and this could all be made more concise by bumping it up to the context file:

"@context:" {
...,
"oboe-characteristics": "http://ecoinformatics.org/oboe/oboe.1.2/oboe-characteristics.owl#",
"Characteristic": { "@id": "oboe-characteristics:Characteristic"},
"Mass": { "@id": "oboe-characteristics:Mass"}
},

"attribute": {
  "@id": "att.12",
  "Characteristic": "Mass"
}

In principle, we should be able to round-trip any of this back to EML by JSON-LD framing using the EML context alone and then converting any terms that are not fully compacted (e.g. not EML) into semantic <annotation> elements.

cc @amoeba

amoeba commented 6 years ago

Cool, nice write-up. This makes sense.

As a note on referencing OBOE, I believe that, because the top-level OBOE ontology imports -core.owl, -characteristics.owl, -standards.owl

<owl:Ontology rdf:about="&oboe-base;oboe.owl">
        <rdfs:label>oboe</rdfs:label>
        <owl:versionInfo>Version 1.1</owl:versionInfo>
        <rdfs:comment>Copyright (c) 2006-2016 The Regents of the University of California.  All rights reserved. This work is licensed under the Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.</rdfs:comment>
        <rdfs:comment>This ontology contains general terms that are common across OBOE extensions.  It extends the OBOE Core model by importing ontologies specific to measurement characteristics, measurement standards, spatial entities, temporal entities, biological taxa, and anatomical entities.</rdfs:comment>
        <owl:imports rdf:resource="&oboe-base;oboe-core.owl"/>
        <owl:imports rdf:resource="&oboe-base;oboe-characteristics.owl"/>
        <owl:imports rdf:resource="&oboe-base;oboe-standards.owl"/>
    </owl:Ontology>

you can safely just do

"@context:" {
  "oboe": "http://ecoinformatics.org/oboe/oboe.1.2/oboe.owl#",
}

if you want to instead.

cboettig commented 6 years ago

This will depend on eml 2.2, which won't support semantic annotations on all objects, so will require additional implementation.

earnaud commented 4 years ago

Hi, I come from the EML package which referenced this issue. I am particularly interested (and enthusiastic) about your work, since I work with EMLassemblyline's team to develop a shiny front-end. Also, I have some questions about current development:

Thank you for your work and any answer you could provide me !

cboettig commented 4 years ago

@earnaud thanks for your message. v2.0 of the EML R package uses emld under the hood, and supports both the EML 2.1.1 and new EML 2.2.0 spec. @jeanetteclark just updated the README here to clarify, so thanks for pointing that out!

You can see examples of the semantics module in the test suite, e.g. https://github.com/ropensci/emld/blob/master/inst/tests/eml-2.2.0/eml-semantics.xml . So yes, EML's semantics module is fully supported, you can use semantics exactly as defined in the spec.

What is not yet supported is being able to automatically convert between an RDF or JSON-LD representation of those semantics and the way those semantics are represented in EML's XML-based standard, as discussed up top. There's nothing in the EML 2.2.0 standard that makes the semantics module explicitly semantic (e.g. it's not implemented as RDFa where it could be extracted with standard tools). Under the hood, emld treats (almost) all of EML as if it were RDF, and so it would be natural to apply the above trick as well but it hasn't been implemented yet!