2

I am new to Jena but now encountered with some problems. I have a superclass Query Processing and its four subclasses:

  • Query Processing
  • — Query intent
  • — Query reformulation
  • — Query representation
  • — Query suggestion

When I use:

PREFIX Article: <http://www.semanticweb.org/aero/ontologies/computer-science#>
SELECT ?paper ?category 
WHERE 
{
  ?paper Article:inQueryIntent ?category .
}

Or with any the other 3 subclasses as the predicate like inQueryReformulation I can get the correct answer.

However when I used ?article Article:inQueryProcessing ?category which should return all the individuals related to the sub-classes QueryProcessing I got nothing. inQueryIntent (and the other 3) and inQueryProcessing are the object properties.

Here is my code:

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

here is the ontology snippet :

object properties:

<!-- 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>

class:

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

individual:

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

I just build a domain ontology in ComputerScience, all the classes are concepts (like query processing is a superclass and query intent/reformulation/… are subclasses) in hierarchy and, all the papers and their corresponding authors are the individuals

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
Sarotti
  • 65
  • 1
  • 3
  • 10
  • 3
    Please don't ask multiple questions in a single question! You have two distinct questions here so please split the second one out into a new question with an appropriate title, doing this will increase your chances of getting useful answers – RobV Apr 24 '13 at 16:30
  • Also your question is not complete, you haven't showed your actual query string nor your data both of which are relevant to the question – RobV Apr 24 '13 at 16:41
  • thank your for reminding sir, I've edit it – Sarotti Apr 25 '13 at 08:50
  • 3
    You need to show the ontology. Without seeing the ontology it's impossible to say for certain but it seems to confuse subclasses with subproperties. – AndyS Apr 25 '13 at 09:08
  • sorry for replying so late cause I was taking exams. now I've attached the snippet of the ontology file. – Sarotti Apr 27 '13 at 14:31
  • It depends on how the data/individuals are asserted, and based on the information provided above you will the answer as expected if `Article:inQueryIntent` etc. properties are declared to subProperty of `Article:inQueryProcessing` and you query the the model in inference mode. – Dibyanshu Jaiswal Dec 22 '14 at 12:19

0 Answers0