OWL2:是否可以将Annotation放在ObjectIntersectionOf上?

时间:2015-06-30 15:23:00

标签: annotations owl ontology pellet

我知道我可以在SubClassOf关系上添加注释:

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

但是,我真正想做的是:

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

我想要的是创建一个对所有具有关系的对象有意义的注释:prop1:instance1和:prop2:instance,而不是子类关系。

我不想为ObjectIntersectionOf创建一个类,因为在我的实例中我将有数千个这样的类。

在下面的文件中运行pellet 2.3.1会产生以下错误:

$ 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)
)

1 个答案:

答案 0 :(得分:1)

不,我认为你不能这样做。 OWL 2规范允许注释本体,公理和实体,复杂的类表达式都不是那些(参见§10 Annotations)。

Pellet与此无关,您从OWL API FSS解析器中收到错误,因为您的本体在语法上是无效的。