0

我知道我可以在 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 创建一个类,因为在我的真实示例中将有数千个这样的类。

在以下文件上运行颗粒 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)

草稿2.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)
)
4

1 回答 1

2

不,我不认为你能做到这一点。OWL 2 规范允许对本体、公理和实体进行注释,而复杂的类表达式都不是这些(参见第 10 节注释)。

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

于 2015-06-30T20:59:37.460 回答