-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Currently when exporting a Section where its type is found in odml.resources.section_subclasses.yaml, the exported RDF class will have the same name as the mapped entry in the file. As an example, a Section with type cell would be exported as rdf:type odml:Cell and will be linked to its parent by the predicate odml:hasSection. This is not enough for proper RDF subclass inference and any SPARQL queries depending on class inference will not work.
To enable proper RDF subclass class inference, the exported RDF document also has to contain an rdfs:Class entry for odml:Section and an rdfs:Class entry for the exported subclass, stating that it is a subclass of class odml:Section.
In our example the export of a minimal odml document should lead to the following RDF file:
```
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:odml="https://g-node.org/odml-rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<rdf:Description rdf:about="https://g-node.org/odml-rdf#Section">
<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
</rdf:Description>
<rdf:Description rdf:about="https://g-node.org/odml-rdf#Cell">
<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<rdfs:subClassOf rdf:resource="https://g-node.org/odml-rdf#Section"/>
</rdf:Description>
<rdf:Description rdf:about="https://g-node.org/odml-rdf#dc38910b-d7d5-4083-b1b3-7dfdf427e6d8">
<rdf:type rdf:resource="https://g-node.org/odml-rdf#Document"/>
<odml:hasFileName>None</odml:hasFileName>
<odml:hasSection rdf:resource="https://g-node.org/odml-rdf#319c06bf-e812-4c74-873e-ac9ee934d23c"/>
</rdf:Description>
<rdf:Description rdf:about="https://g-node.org/odml-rdf#319c06bf-e812-4c74-873e-ac9ee934d23c">
<odml:hasName>Cell</odml:hasName>
<rdf:type rdf:resource="https://g-node.org/odml-rdf#Cell"/>
<odml:hasType>cell</odml:hasType>
</rdf:Description>
<rdf:Description rdf:about="https://g-node.org/odml-rdf#Hub">
<odml:hasDocument rdf:resource="https://g-node.org/odml-rdf#dc38910b-d7d5-4083-b1b3-7dfdf427e6d8"/>
</rdf:Description>
</rdf:RDF>
```
When loading this document into an RDF graph, both of the following SPARQL queries need to return the same result for the RDF subclassing to be properly implemented:
SELECT * WHERE {?s rdf:type odml:Cell .}SELECT * WHERE {?s rdf:type odml:Section .}
An implementation has to make sure, that all entries from the default RDF subclass mapping file odml.resources.rdf_subclasses.yaml are properly exported and inferred. The same is true for custom RDF subclass mappings. See issue #395 for details.
Note that the rdflib implementation also does not provide RDF class inference. To properly test this, libraries like owlrl have to be used in addition to an rdflib graph.