owlcs/owlapi

Triple parsing errors triggered by annotations on XSD datatypes

Closed this issue · 3 comments

jmkeil commented

I am facing triple parsing errors triggered by annotations on XSD datatypes. Unfortunately, I was not able to come up with clear reproduction steps yet. The problem occurs in Protege as well as in ROBOT. Therefore, I think it is an OWL API problem.

If a datatype is annotated with some property (e.g xsd:decimal rdfs:isDefinedBy <http://example.org/my/ontology#> ., e.g. due to ontodev/robot#1163; also with other properties; property might be declared or undeclared -> not #1026), Protege sometimes shows the datatype in the class hierarchy too (see first image) or sometimes it is replaced in some restrictions with an Error resource (see second image) or sometimes both. However, the error does not occur always for the same file and if it occurs, not always for all restrictions that use the datatype. But an occurrence seems to become more likely for larger ontology files. Each occurrence comes together with an parsing error in the logs:

ERROR  09:25:56  Entity not properly recognized, missing triples in input? http://org.semanticweb.owlapi/error#Error1 for type Class
INFO  09:25:56  Unparsed triple: _:genid-nodeid-node1hg06utqmx78 -> http://www.w3.org/2002/07/owl#withRestrictions -> _:genid-nodeid-node1hg06utqmx79
INFO  09:25:56  Unparsed triple: _:genid-nodeid-node1hg06utqmx78 -> http://www.w3.org/2002/07/owl#onDatatype -> http://www.w3.org/2001/XMLSchema#decimal

But the triples in the TTL file are fine:

[…]
  owl:someValuesFrom [ rdf:type rdfs:Datatype ;
					   owl:onDatatype xsd:decimal ;
					   owl:withRestrictions ( [ xsd:maxInclusive 0.01
											  ]
											)
					 ]
[…]

The same error log entry is sometimes shown by ROBOT.

Screenshot 2023-11-24 092401
Screenshot 2023-11-24 092751

ErrorX is a hallmark of missing essential triples, usually the type triple itself. Can you show the top of the file in question? I'm wondering about namespaces. Also xsd:maxInclusive 0.01 might be missing a datatype declaration for the literal.

jmkeil commented

Can you show the top of the file in question? I'm wondering about namespaces.

[…]
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix vann: <http://purl.org/vocab/vann/> .
@prefix schema: <https://schema.org/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
[…]

Also xsd:maxInclusive 0.01 might be missing a datatype declaration for the literal.

0.01 is syntactic sugar for "0.01"^^xsd:decimal in TTL, so that is fine.

ErrorX is a hallmark of missing essential triples, usually the type triple itself.

I do not think that a syntactic error or a missing triple is causing this issue, because the error does not deterministically occur:

  • robot convert --input "test-owlapi-1116.ttl" --output out.ttl showed in 4 of 10 runs the following error:

    2023-11-27 09:35:59,966 ERROR org.semanticweb.owlapi.rdf.rdfxml.parser.OWLRDFConsumer - Entity not properly recognized, missing triples in input? http://org.semanticweb.owlapi/error#Error1 for type Class
    2023-11-27 09:36:00,026 ERROR org.obolibrary.robot.IOHelper - Input ontology contains 2 triple(s) that could not be parsed:

  • After adding xsd:decimal rdf:type rdfs:Datatype . the error occurred again in 5 of 10 runs.

  • But after removing xsd:decimal rdfs:isDefinedBy <http://example.org/my/ontology#> . (and without xsd:decimal rdf:type rdfs:Datatype ., so there is no triple with xsd:decimal as subject left) the error occurred in 0 of 10 runs.

Unfortunately, I can not share the file and I was not able to produce an minimal working example yet. I first would need to dig a little bit into ontology anonymization …

@ignazio1977 Is the issue solved or just stalled?