我是耶拿的新手,但现在遇到了一些问题。我有一个超类查询处理及其四个子类:
当我使用时:
PREFIX Article: <http://www.semanticweb.org/aero/ontologies/computer-science#>
SELECT ?paper ?category
WHERE
{
?paper Article:inQueryIntent ?category .
}
或者使用任何其他3个子类作为谓词,如inQueryReformulation
,我可以得到正确的答案。
然而,当我使用?article Article:inQueryProcessing ?category
时,它应该返回与子类QueryProcessing相关的所有个体,我什么也没得到。 inQueryIntent
(以及其他3)和inQueryProcessing
是对象属性。
这是我的代码:
Dataset dataset = TDBFactory.createDataset(directory);
Model model = dataset.getNamedModel(modelName);
OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF, model);
Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
InfModel infModel = ModelFactory.createInfModel(reasoner, ontModel);
Query query = QueryFactory.create(queryString);
QueryExecution queryExe = QueryExecutionFactory.create(query, infModel);
这是本体片段:
对象属性:
<!-- http://www.semanticweb.org/aero/ontologies/2013/1/computer-science#inQueryIntent -->
<owl:ObjectProperty rdf:about="http://www.semanticweb.org/aero/ontologies/2013/1/computer-science#inQueryIntent">
<rdf:type rdf:resource="&owl;FunctionalProperty"/>
<rdfs:range rdf:resource="http://www.semanticweb.org/aero/ontologies/2013/1/computer-science#Query_intent"/>
<rdfs:domain rdf:resource="http://www.semanticweb.org/aero/ontologies/2013/1/computer-science#article"/>
<rdfs:subPropertyOf rdf:resource="http://www.semanticweb.org/aero/ontologies/2013/1/computer-science#inInformationRetrievalQueryProcessing"/>
</owl:ObjectProperty>
类:
<owl:Class rdf:about="http://www.semanticweb.org/aero/ontologies/2013/1/computer-science#Query_intent">
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/aero/ontologies/2013/1/computer-science#Information_retrieval_query_processing"/>
</owl:Class>
个体:
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/aero/ontologies/2013/1/computer-science#Classifying_Web_Queries_by_Topic_and_User_Intent">
<rdf:type rdf:resource="http://www.semanticweb.org/aero/ontologies/2013/1/computer-science#article"/>
<hasAuthor rdf:resource="http://www.semanticweb.org/aero/ontologies/2013/1/computer-science#Bernard_J._Jansen"/>
<inQueryIntent rdf:resource="http://www.semanticweb.org/aero/ontologies/2013/1/computer-science#Query_intent"/>
</owl:NamedIndividual>
我只是在ComputerScience中构建域本体,所有类都是层次结构中的概念(如查询处理是超类,查询意图/重构/ ...是子类),所有论文及其相应的作者都是个人