0

I know I can put annotations on a SubClassOf relation:

SubClassOf(
    Annotation(rdfs:comment "This annotation is valid")
    ObjectIntersectionOf(
        ObjectHasValue(:prop1 :instance1) 
        ObjectHasValue(:prop2 :instance2)
    )
    ObjectHasValue(:prop3 :instance3)
)

However, what I really wanted to do is this:

SubClassOf(
    ObjectIntersectionOf(
        Annotation(rdfs:comment "This annotation is invalid")
        ObjectHasValue(:prop1 :instance1) 
        ObjectHasValue(:prop2 :instance2)
    )
    ObjectHasValue(:prop3 :instance3)
)

What I want is to create an annotation meaningful to all objects with the relations :prop1 :instance1 and :prop2 :instance, and not to the subclass relation.

I don't want to create a class for the ObjectIntersectionOf, as I will have thousands of such classes on my real example.

Running pellet 2.3.1 on the file below yields the following error:

$ pellet.sh explain draft2.owl

There are 1 input files:
./draft2.owl
Start loading
org.semanticweb.owlapi.io.UnparsableOntologyException: Problem parsing file:/home/users/djogo/Desktop/ontologia%20tnm/draft2.owl
Could not parse ontology.  Either a suitable parser could not be found, or parsing failed.  See parser logs below for explanation.
The following parsers were tried:
1) RDFXMLParser
2) OWLXMLParser
3) OWLFunctionalSyntaxOWLParser
4) TurtleOntologyParser
5) OWLOBOParser
6) KRSS2OWLParser
7) ManchesterOWLSyntaxOntologyParser


Detailed logs:
--------------------------------------------------------------------------------
Parser: RDFXMLParser
org.xml.sax.SAXParseException; systemId: file:/home/users/djogo/Desktop/ontologia%20tnm/draft2.owl; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

--------------------------------------------------------------------------------
Parser: OWLXMLParser
org.xml.sax.SAXParseException; systemId: file:/home/users/djogo/Desktop/ontologia%20tnm/draft2.owl; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

--------------------------------------------------------------------------------
Parser: OWLFunctionalSyntaxOWLParser
Encountered "" at line 8, column 9.
Was expecting one of:
     (Line 7)

--------------------------------------------------------------------------------
Parser: TurtleOntologyParser
uk.ac.manchester.cs.owl.owlapi.turtle.parser.ParseException: Encountered "" at line 1, column 1.
Was expecting one of:


--------------------------------------------------------------------------------
Parser: OWLOBOParser
org.coode.owlapi.obo.parser.TokenMgrError: Lexical error at line 6, column 12.  Encountered: "\n" (10), after : ""

--------------------------------------------------------------------------------
Parser: KRSS2OWLParser
de.uulm.ecs.ai.owlapi.krssparser.ParseException: Encountered " <NAME> "Prefix "" at line 1, column 1.
Was expecting:
    <EOF> 


--------------------------------------------------------------------------------
Parser: ManchesterOWLSyntaxOntologyParser
Encountered Prefix at line 1 column 1. Expected one of:
    DifferentIndividuals:
    Individual:
    Class:
    AnnotationProperty:
    Import:
    DisjointClasses:
    ObjectProperty:
    Datatype:
    EquivalentClasses:
    SameIndividual:
    Prefix:
    DataProperty:
    DisjointProperties:
    ValuePartition:
 (Line 1)


    at uk.ac.manchester.cs.owl.owlapi.ParsableOWLOntologyFactory.loadOWLOntology(ParsableOWLOntologyFactory.java:236)
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:880)
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:818)
    at com.clarkparsia.pellet.owlapiv3.OWLAPILoader.parseFile(OWLAPILoader.java:142)
    at org.mindswap.pellet.KBLoader.parse(KBLoader.java:99)
    at com.clarkparsia.pellet.owlapiv3.OWLAPILoader.parse(OWLAPILoader.java:128)
    at org.mindswap.pellet.KBLoader.createKB(KBLoader.java:65)
    at pellet.PelletCmdApp.getKB(PelletCmdApp.java:210)
    at pellet.PelletCmdApp.getKB(PelletCmdApp.java:198)
    at pellet.PelletExplain.parseArgs(PelletExplain.java:204)
    at pellet.Pellet.run(Pellet.java:104)
    at pellet.Pellet.main(Pellet.java:59)

draft2.owl

Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)
Prefix(:=<http://cipe.accamargo.org.br/ontologias/tnm.owl#>)

Ontology(<http://cipe.accamargo.org.br/ontologias/tnm.owl>

SubClassOf(
    ObjectIntersectionOf(
        Annotation(rdfs:comment "This annotation is invalid")
        ObjectHasValue(:prop1 :instance1) 
        ObjectHasValue(:prop2 :instance2)
    )
    ObjectHasValue(:prop3 :instance3)
)
Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58

1 Answers1

2

No, I don't think you can do this. The OWL 2 spec allows for annotations of ontologies, axioms, and entities, and complex class expressions are neither of those (see §10 Annotations).

Pellet has nothing to do with this, you get the error from the OWL API FSS parser since your ontology is syntactically invalid.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
Pavel Klinov
  • 436
  • 3
  • 7
  • Thanks for your answer. Do you have any suggestion on how to annotate this? – Diogo FC Patrao Jun 30 '15 at 21:29
  • I'm not sure I understand what you mean by "create an annotation meaningful to all objects with...". What's meaningful? If you want that any individual which is inferred to be an instance of the conjunction, would be somehow related to a specific annotation, then I don't see a way other than introducing a new class name (i.e. a new entity) that is a superclass of the conjunction and then annotating that entity. This could, of course, slow down classification and clutter your class view in Protege (or whatever). – Pavel Klinov Jun 30 '15 at 22:06
  • Let's say that the class expression ObjectIntersectionOf ( ObjectHasValue (:prop1 :instance1) ObjectHasValue (:prop2 :instance2a) ) means small cats and ObjectIntersectionOf ( ObjectHasValue (:prop1 :instance1) ObjectHasValue (:prop2 :instance2b) ) means small dogs. I need to know when something is a small dog or small cat, however, I don't need the class - I'll just query for small things, or for all sizes of cat. As I'll have lots of sizes and lots of animals, I wanted to save classes to get better performance. – Diogo FC Patrao Jul 01 '15 at 02:00
  • It sounds like you're looking for annotations of queries (DL queries, i.e. queries with complex class expressions, in this case), rather than annotations of things in your ontology. – Pavel Klinov Jul 01 '15 at 07:48
  • If you're running the same queries multiple times, naming the classes you're looking up might actually improve performance. Don't dismiss that idea without trying it first. – Ignazio Jul 01 '15 at 14:35
  • I ended up creating the classes I didn't wanted to create. Inference took 874min (14h) with pellet 2.3.0 using 2GB in a 2.0GHz machine (Input size: Classes = 804, Properties = 10, Individuals = 612). I'm removing those classes, will run the inference again and post the results. – Diogo FC Patrao Jul 22 '15 at 12:59
  • It took 21 minutes with the same setup but none of those classes (Input size: Classes = 587, Properties = 10, Individuals = 612) Expressivity in both runs was EL+ (according to Pellet). The command line was 'pellet.sh extract -s AllIndividuals ' – Diogo FC Patrao Jul 22 '15 at 16:56
  • If expressivity is EL+, you may want to classify it using ELK, should be faster: elk.semanticweb.org – Pavel Klinov Jul 23 '15 at 13:22