Search code examples
annotationsowlowl-api

Ontology annotation type is missing in saved ontology file


I'm using OWL API 4.1. I add annotation with type XSD:string like that:

OWLAnnotationProperty annotationProperty = this.getDf().getOWLAnnotationProperty(annotationPropertyIri);
OWLLiteral lit = this.df.getOWLLiteral(annotationValue, range);
OWLAnnotation annotation = df.getOWLAnnotation(annotationProperty, lit);
this.getMng().applyChange(new AddOntologyAnnotation(this.getOnt(), annotation));

... I checked that here lit="test"^^xsd:string. But after I saved ontology (in ttl format) - there in no type ending - ^^xsd:string:

...
<http://semanticweb.rocks/whole-dataset-name/wheat-02> a owl:Ontology ;
    dc:description """test""" ;
    dc:source """http://mail.ru"""^^xsd:anyURI .
...

If I use other type (e.g. xsd:anyURI ) instead of ^^xsd:string the ending ^^xsd:anyURI is presented.

What is matter with ^^xsd:string?


Solution

  • The xsd:string type can be skipped for string literals, when there is no language tag. A literal typed with xsd:string is identical to a plain literal with no language tag.

    If you load the ontology back into an OWLOntology, I expect you to see a test^^xsd:string literal attached to the ontology.