我有一个很多个人的本体论,并且使用耶拿推理者来获取关于他们的信息。我的目标是根据规则中给定的信息创建新的个人并为其分配属性。个人不必命名,但他们需要一个类型,并且必须是少数属性的一部分。目前我可以创建匿名个人(在mailing list post的帮助下),但我只能给他们一个类型或一个属性。在耶拿规则里创建个人
这是我的问题的一个小例子;我的原则是这样的(本体和推断的结果可以在底部找到):
[测试2:(X RDF:类型NS:?Test1的) - >
[(Y的rdf:类型NS:?的Test2)< - makeSkolem(Y,X)]]
这意味着当一个测试1个体中发现,则一个新的空白节点被创建,然后键入Test2授予能够节点。它工作正常,但我想给这个新的个人分类和指针(属性)?X(Test1个人)。
类似下面的内容不起作用,因为“后向规则只允许一个头句子”。尽管如此,其中的每个子句都完美无缺。
[TEST2:(X的rdf:类型NS:测试1) - (ÿ的rdf:类型NS:的Test2)>
[(?ÿNS:hasClassification '测试'), < - makeSkolem(?Y,X)]]
这是我的本体论:
<rdf:RDF
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="file:/Test#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
<rdf:Description rdf:about="file:/Test#hasClassification">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#TestProp">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#testInd">
<rdf:type rdf:resource="file:/Test#Test1"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#testInd2">
<rdf:type rdf:resource="file:/Test#Test1"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#Test1">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#Test2">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
</rdf:Description>
</rdf:RDF>
这是与结果第一条规则(使用标识A0
和A1
空白节点是新人类):
<rdf:RDF
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="file:/Test#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
<rdf:Description rdf:about="file:/Test#hasClassification">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
</rdf:Description>
<rdf:Description rdf:nodeID="A0">
<rdf:type rdf:resource="file:/Test#Test2"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#TestProp">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#testInd">
<rdf:type rdf:resource="file:/Test#Test1"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#testInd2">
<rdf:type rdf:resource="file:/Test#Test1"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#Test1">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test#Test2">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
<rdf:Description rdf:nodeID="A1">
<rdf:type rdf:resource="file:/Test#Test2"/>
</rdf:Description>
<rdf:Description rdf:about="file:/Test">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
</rdf:Description>
</rdf:RDF>
我用了反向链接规则,因为之前的makeSkolum()和我一起工作makeInstance()仅在后向/混合规则中可用。尝试使用makeInstance()一整天后,我没有考虑使用makeSkolum()使用简单的前向规则。它工作得非常好,但非常非常好(也适用于你的第二个解释)。我仍然有很多要了解耶拿,我很感谢你第二次帮助我。希望我在不久的将来再也不需要帮助。你是否想回答这个问题,以便我可以将其标记为已解决并给予您应有的信用? – ImmaCute
我很高兴这有帮助!我已经添加了它的本质作为答案。 –