How to modify/delete axioms

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

How to modify/delete axioms

akirafei
This post was updated on .
I have axiom data in owl file: like
<owl:Axiom>
  <owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/NCBITaxon_100"/>
  <owl:annotatedProperty rdf:resource="http://www.geneontology.org/formats/oboInOwl#hasRelatedSynonym"/>
  <oboI:hasSynonymType rdf:resource="http://purl.obolibrary.org/obo/ncbitaxon#synonym"/>
  <owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Microcyclus aquaticus</owl:annotatedTarget>
</owl:Axiom>


How can access and modify/delete those data?

tried list(onto.general_axioms()) which gives me an empty list.
Reply | Threaded
Open this post in threaded view
|

Re: How to modify/delete axioms

Jiba
Administrator
Hi,

This is an axiom for annotating a relation between two entities. You can create/modify/destroy  such axiom in Owlready via the annotation (here, it is oboI:hasSynonymType).

You need to load the obol and oboInOwl ontologies and the obo namespace, and then you can access it as:

obol.hasSynonymType[obo.NCBITaxon_100, oboInOwl.hasRelatedSynonym, "Microcyclus aquaticus"]

It acts as a list of annotation values; you can read the list but also add/remove items.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: How to modify/delete axioms

akirafei
Thanks Jiba,

I do able to access it.

Is it possible for me to simply delete all such hasSynonymType annotation for any given obo.NCBITaxon_XXX? without need to specify the value "Microcyclus aquaticus"

Thanks,
Reply | Threaded
Open this post in threaded view
|

Re: How to modify/delete axioms

Jiba
Administrator
Hi,

I think the easiest solution for that is SPARQL, for instance:


default_world.sparql("""
PREFIX oboInOwl: <http://www.ontobee.org/ontologies/oboInOwl.owl#>
DELETE { ?a ?x ?y . }
WHERE {
  ?a rdf:type owl:Axiom .
  ?a owl:annotatedSource obo:NCBITaxon_XXX .
  ?a owl:annotatedProperty oboInOwl:hasRelatedSynonym .
  ?a ?x ?y .
}""")

Jiba