What is the best way to generate below using dotnetrdf? Assuming I have defined al the namespaces, I am trying to output the following:
<owl:Class rdf:about = "http://my.taxonomies.com/myModel/Lion" >
<rdfs:label xml:lang = "en"> Lion </ rdfs:label>
<rdfs:subClassOf> <owl:Class rdf:about = "http://my.taxonomies.com/myModel/Animals" />
<rdfs:subClassOf>
</owl:Class>
The tutorials I went through did not have an owl class example.
Thanks
You have two options when creating OWL ontologies in dotNetRDF. You can create a graph and use the Assert methods to assert the triples you want in your ontology graph (this is the low-level API if you like); or you can use the helper classes and methods in the
VDS.RDF.Ontologynamespace which abstract away some of the steps you need to take when making an ontology graph.There are docs for the basic operations of the low-level API here, and for the ontology API here
This is an example of creating your graph using the low-level APIs:
When this graph is serialized as RDF/XML the output you get is:
And this code creates the same graph, using the Ontology helpers:
The RDF/XML generated for this graph is the same as before:
The
OntologyGraphclass actually extendsGraphso you can mix-and-match these modes, using either the low-level or the higher-level APIs on it.