robot icon indicating copy to clipboard operation
robot copied to clipboard

REMOVE misses annotations to remove

Open jmkeil opened this issue 1 year ago • 3 comments

I tried to work around #1163 with robot remove. In case of the small example in #1163 it worked out with the following command:

robot \
  merge \
    --input test-robot-xsd.ttl \
    --annotate-defined-by true \
  remove \
    --select "xsd:*" \
    --axioms annotation \
    --preserve-structure false \
    --output test-robot-xsd.merge+remove.ttl

However, in cases of a larger file (which I unfortunately can not share by now), it failed to remove some annotations. --preserve-structure false is needed to avoid the property hierarchy getting messed up. But the problem also occurs without --preserve-structure false.

From the result without remove command:

…
#################################################################
#    Datatypes
#################################################################

###  http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral
rdf:PlainLiteral rdfs:isDefinedBy <http://purl.obolibrary.org/obo/bfo.owl> .


###  http://www.w3.org/2000/01/rdf-schema#Literal
rdfs:Literal rdfs:isDefinedBy <http://purl.obolibrary.org/obo/iao.owl> .


###  http://www.w3.org/2001/XMLSchema#anyURI
xsd:anyURI rdfs:isDefinedBy <http://purl.obolibrary.org/obo/bfo.owl> .


###  http://www.w3.org/2001/XMLSchema#boolean
xsd:boolean rdfs:isDefinedBy <http://purl.obolibrary.org/obo/bfo.owl> .


###  http://www.w3.org/2001/XMLSchema#dateTime
xsd:dateTime rdfs:isDefinedBy <http://purl.obolibrary.org/obo/iao.owl> .


###  http://www.w3.org/2001/XMLSchema#decimal
xsd:decimal rdfs:isDefinedBy <http://example.org/my/ontology#> .


###  http://www.w3.org/2001/XMLSchema#double
xsd:double rdfs:isDefinedBy <http://purl.obolibrary.org/obo/iao.owl> .


###  http://www.w3.org/2001/XMLSchema#float
xsd:float rdfs:isDefinedBy <http://purl.obolibrary.org/obo/iao.owl> .


###  http://www.w3.org/2001/XMLSchema#integer
xsd:integer rdfs:isDefinedBy <http://example.org/my/ontology#> .


###  http://www.w3.org/2001/XMLSchema#nonNegativeInteger
xsd:nonNegativeInteger rdfs:isDefinedBy <http://example.org/my/ontology#> .


###  http://www.w3.org/2001/XMLSchema#string
xsd:string rdfs:isDefinedBy <http://purl.obolibrary.org/obo/iao.owl> .


#################################################################
#    Object Properties
#################################################################
…

From the result with remove command:

…
#################################################################
#    Datatypes
#################################################################

###  http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral
rdf:PlainLiteral rdfs:isDefinedBy <http://purl.obolibrary.org/obo/bfo.owl> .


###  http://www.w3.org/2000/01/rdf-schema#Literal
rdfs:Literal rdfs:isDefinedBy <http://purl.obolibrary.org/obo/iao.owl> .


###  http://www.w3.org/2001/XMLSchema#anyURI
xsd:anyURI rdfs:isDefinedBy <http://purl.obolibrary.org/obo/bfo.owl> .


###  http://www.w3.org/2001/XMLSchema#dateTime
xsd:dateTime rdfs:isDefinedBy <http://purl.obolibrary.org/obo/iao.owl> .


###  http://www.w3.org/2001/XMLSchema#string
xsd:string rdfs:isDefinedBy <http://purl.obolibrary.org/obo/iao.owl> .


#################################################################
#    Object Properties
#################################################################
…

I would have expected, that the annotations for xsd:anyURI, xsd:dateTime and xsd:string would be removed too. Any idea what could be the reason?

An workaround could be the use of SPARQL UPDATE, but that is not nice, as it would require an additional query file and an additional convert command, to preserve the OWL API serialization.

jmkeil avatar Nov 21 '23 13:11 jmkeil

To clarify: In the larger file you mention, are these XSD datatypes used in the range, domain, or other logic of some terms?

jamesaoverton avatar Nov 29 '23 17:11 jamesaoverton

From the above datatypes these are used in some logic:

xsd:anyURI
xsd:boolean
xsd:dateTime
xsd:decimal
xsd:double
xsd:float
xsd:integer
xsd:nonNegativeInteger
xsd:string

And these are not used in some logic:

rdfs:Literal
rdf:PlainLiteral

jmkeil avatar Nov 30 '23 08:11 jmkeil

Thanks! I was hoping that list would help clarify the problem, but it doesn't help me. Hopefully a fix for #1163 will mean this problem is avoided.

jamesaoverton avatar Nov 30 '23 17:11 jamesaoverton