Using Annotations for Object Property Assertions

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

Using Annotations for Object Property Assertions

Marie
Dear all,

we recently discovered annotations for object property assertions as a powerful tool. Is there a way to insert and read annotations of this type via Owlready2?

The following is a toy example of what we plan to do. We would like to insert the "Axiom" part (individuals section).

<?xml version="1.0"?>


<!DOCTYPE rdf:RDF [
    <!ENTITY owl "http://www.w3.org/2002/07/owl#" >
    <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
    <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
    <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
    <!ENTITY test_annotation "http://www.semanticweb.org/maris/ontologies/2019/3/test_annotation.owl#" >
]>


<rdf:RDF xmlns="http://www.semanticweb.org/maris/ontologies/2019/3/test_annotation.owl#"
     xml:base="http://www.semanticweb.org/maris/ontologies/2019/3/test_annotation.owl"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:owl="http://www.w3.org/2002/07/owl#"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:test_annotation="http://www.semanticweb.org/maris/ontologies/2019/3/test_annotation.owl#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
    <owl:Ontology rdf:about="http://www.semanticweb.org/maris/ontologies/2019/3/test_annotation.owl"/>
   


   

   


   

   


   

   


   

    <owl:ObjectProperty rdf:about="&test_annotation;isRelated"/>
   


   

   


   

    <owl:Class rdf:about="&test_annotation;A"/>
   


   

   


   

    <owl:NamedIndividual rdf:about="&test_annotation;a1">
        <rdf:type rdf:resource="&test_annotation;A"/>
        <isRelated rdf:resource="&test_annotation;a2"/>
    </owl:NamedIndividual>
    <owl:Axiom>
        <rdfs:comment>test</rdfs:comment>
        <owl:annotatedSource rdf:resource="&test_annotation;a1"/>
        <owl:annotatedTarget rdf:resource="&test_annotation;a2"/>
        <owl:annotatedProperty rdf:resource="&test_annotation;isRelated"/>
    </owl:Axiom>
   


   

    <owl:NamedIndividual rdf:about="&test_annotation;a2">
        <rdf:type rdf:resource="&test_annotation;A"/>
    </owl:NamedIndividual>
</rdf:RDF>


Best regards,
Marie
Reply | Threaded
Open this post in threaded view
|

Re: Using Annotations for Object Property Assertions

Jiba
Administrator
Hi,

Yes, you can annotation triples with Owlready. The syntax is the following:

annotation_class[subject, property, value] = annotation_value.

For example:

comment[individual, property, value] = ["my comment"]

You can use the 'comment' RDF annotation, or define your own annotations by subclassing the AnnotationProperty class.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Using Annotations for Object Property Assertions

Marie
Thanks for the quick reply. Works fine.