How to assign rdf:type attribute to a class in existing ontology

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to assign rdf:type attribute to a class in existing ontology

akirafei

I am looking at NCBI taxon ontology

A taxon is define like:

<owl:Class rdf:about="http://purl.obolibrary.org/obo/NCBITaxon_191554">
  <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Hysteriales</rdfs:label>
  ....
</owl:Class>

I wish to use owlready2 to load the ontology and add an attribute like:

<owl:Class rdf:about="http://purl.obolibrary.org/obo/NCBITaxon_191554">
  <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Hysteriales</rdfs:label>
  <rdfs:type rdf:resource="http://xxxxx/xx/xx#Taxon"/> 
  ...
</owl:Class>
 
I did not find any clue in documentation talking about set the rdf:type.

But it does able to search type like onto.search(type="xxx"), so I think the information is captured in owl ready.

Reply | Threaded
Open this post in threaded view
|

Re: How to assign rdf:type attribute to a class in existing ontology

Jiba
Administrator
Hi,

Adding rdf:type to a class is normally not used in OWL, and not supported directly by Owlready (it seems that it is the same for Protégé).

However, you can assert the RDF triple directly as follows:

onto._add_obj_triple_spo(obo.NCBITaxon_191554.storid, rdf_type, Taxon.storid)

Jiba