SPARQL query on inferred data does not return any data


(Mahsa87) #1

Hello there,
I’ve started to use Stardog recently and I’m struggling with SPARQL with reasoning on.
I chose a database with SL reasoning to retrieve the data coming from SWRL. I’m trying to query an inferred data but the query seems to be running and running and running and never stops to give me back any result!
I tried to extend the ‘time out’ timer from 60s to higher numbers too, but still no result!
I don’t know if i have to change my rules or there’s something wrong with my Stardog settings?
Here is my rule:

Descriptor(?des) ^ HC_w/Impairment(?hc) ^ Passenger_With_Impairment(?p) ^ 
Suggested(?com) ^ 'Quality of vision'(?icf) ^ involvesICFCode(?des, ?icf) ^ 
isDescribedBy(?hc, ?des) ^ hasSuggestedComfortSetting(?p, ?com) ^ 
isInHealthCondition(?p, ?hc) ^ decidesWhereToRead(?p, Living) ^ 
decidesToRead(?p, true)
-> setsLightColor(?com, Violet) ^ setsLightIntensity(?com, "high") ^ setsTemperature(?com, "low")

And this is the SPARQL I’m trying:

SELECT ?passenger ?Suggested_temperature ?Suggested_LightColor ?Suggested_Intensity
 WHERE { ?passenger rdf:type passenger:Passenger_With_Impairment ;
                  passenger:hasSuggestedComfortSetting ?comfset .
 ?comfset rdf:type comfort:Suggested;
           comfort:setsLightColor ?Suggested_LightColor ;
           comfort:setsLightIntensity ?Suggested_Intensity ;
           comfort:setsTemperature ?Suggested_temperature .
?Suggested_LightColor rdf:type dev:LightCharact .       
}

I also read that Stardog only supports the schema-only reasoning, but I don’t know how it might affect the rules?
Can you please help me out with this problem?
Many thanks!


(Jess Balint) #2

Hi, and welcome.

How large is your database? Have you added any additional rules or OWL axioms? Can you share the plan for this query (using the query explain command)?

Best regards,
Jess


(Mahsa87) #3

Hi,
not really huge database, around 200KB.
I have another rules in my ontology but not related to this particular query that i need.
I need to retrieve three suggestions for passenger with impairment which according to my rules are as follow:
setsLightColor (Violet)
setsLightIntensity (“high”)
setsTemperature (“low”)

And in my query are these three:
comfort:setsLightColor ?Suggested_LightColor ;
comfort:setsLightIntensity ?Suggested_Intensity ;
comfort:setsTemperature ?Suggested_temperature .
Thanks!


(zachary.whitley) #4

Welcome to Stardog. Lets start off with the usual barrage of questions.

What version of Stardog are you running?
What platform are you running on Linux/Windows/Other?
Are there any warnings or errors in the logs? ($STARDOG_HOME/stardog.log)
Can you share your ontology/rules?
Can you share your data?

Am I correct that you loaded your rules in a different format than the one you provided since Stardog doesn’t support the SWRL human readable format? Can you share the actual rule syntax you did load them with? It might be more verbose but there might be something in there that is causing the problem.

I’m not quite sure what you mean by “schema-only reasoning”. I think you might be referring to the restriction on DL reasoning that the schema and data fit into memory.

Can you include the query plan? stardog query explain....


(Mahsa87) #6

I’m using the Stardog version 5.3.1 on Windows 10 platform.

Is it not enough to define swrl within the protege and upload the ontology on Stardog?
In fact I haven’t loaded any other rule to database! Do I have to load them in separate file in Stardog format? But it’s not possible to Add ttl file to database since it gives me back the error of Invalid data type!
Could you please help on how to insert my rules inside Stardog?

Here’s my Stardog log file:

WARN 2018-06-16 16:09:02,829 [Stardog.Executor-24] com.clarkparsia.blackout.ClausificationVisitor:visit(723): Unsupported rule: (PropertyAssertion(?urn:swrl#de,device:emitsLightColor,?urn:swrl#color)) :- (TypeAssertion(?urn:swrl#p,passenger:Passenger), TypeAssertion(?urn:swrl#comf,comfort:Preferred), TypeAssertion(?urn:swrl#de,device:Lamp), TypeAssertion(?urn:swrl#p,not(passenger:Passenger_With_Impairment)), PropertyAssertion(?urn:swrl#p,passenger:hasPreferredComfortSetting,?urn:swrl#comf), PropertyAssertion(?urn:swrl#comf,comfort:setsLightColor,?urn:swrl#color), PropertyAssertion(?urn:swrl#p,eCabin-Common:decidesWhereToRead,cabin:Sleeping), PropertyAssertion(?urn:swrl#de,device:isSituatedinArea,cabin:Sleeping), PropertyAssertion(?urn:swrl#p,eCabin-Common:decidesToRead,“true”^^xsd:boolean))
.ClausificationVisitor:visit(723): Unsupported rule: (PropertyAssertion(?urn:swrl#de,device:emitsLightIntensity,“high”)) :- (TypeAssertion(?urn:swrl#p,passenger:Passenger), TypeAssertion(?urn:swrl#comf,comfort:Preferred), TypeAssertion(?urn:swrl#de,device:Lamp), TypeAssertion(?urn:swrl#p,not(passenger:Passenger_With_Impairment)), PropertyAssertion(?urn:swrl#p,passenger:hasPreferredComfortSetting,?urn:swrl#comf), PropertyAssertion(?urn:swrl#comf,comfort:setsLightColor,?urn:swrl#color), PropertyAssertion(?urn:swrl#p,eCabin-Common:decidesWhereToRead,cabin:Living), PropertyAssertion(?urn:swrl#de,device:isSituatedinArea,cabin:Living), PropertyAssertion(?urn:swrl#p,eCabin-Common:decidesToRead,“true”^^xsd:boolean))
WARN 2018-06-16 16:11:25,413 [stardog-user-10] com.complexible.stardog.reasoning.blackout.TypeOracle:inferTypes(225): The type of variable decidesWhereToRead is ambiguous; it will be assumed to be PROPERTY.

And here is my query plan:

Projection(?passenger, ?Suggested_temperature, ?Suggested_LightColor, ?Suggested_Intensity) [#1]
─ MergeJoin(?Suggested_LightColor) [#1] 
+─ Sort(?Suggested_LightColor) [#1] 
│─ MergeJoin(?comfset) [#1]
│ +─ Sort(?comfset) [#1]
│ │ ─ MergeJoin(?passenger) [#1]
│ │ +─ Scan[POSC](?passenger, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, passenger:Passenger_With_Impairment) [#1] 
│ │─ Scan[PSOC](?passenger, passenger:hasSuggestedComfortSetting, ?comfset) [#1]
│ ─ NaryJoin(?comfset) [#1]
│ +─ Scan[PSOC](?comfset, comfort:setsTemperature, ?Suggested_temperature) [#1] 
│ +─ Scan[PSOC](?comfset, comfort:setsLightIntensity, ?Suggested_Intensity) [#1] 
│ +─ Scan[PSOC](?comfset, comfort:setsLightColor, ?Suggested_LightColor) [#1] 
│─ Scan[POSC](?comfset, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, comfort:Suggested) [#1]
`─ Scan[POSC](?Suggested_LightColor, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, dev:LightCharact) [#1]

Many thanks!


(zachary.whitley) #7

You should be fine with loading it with the standard swrl rdf syntax. It might make a difference with where you load it and what options you’ve chosen for your database. You can setup Stardog to look in a specific location for your schema/rules/ontology. It should pick it up wherever you put it if you’re going with the default db setup.

I’m not sure what’s going on there but Stardog should be fine loading ttl files. It might get a little confused if you use a non standard file extension in which case you’d need to tell it what type you’re trying to load or if the actual serialization doesn’t match the extension like trying to load a .ttl when it actually has rdf/xml in it.

It looks like you’ve definitely got some problems in the logs. If I’m reading that correctly it looks like it’s somehow reading the rule as the human readable syntax and saying that it doesn’t understand it. I’m not sure how it’s even able to parse the file. Can you include the actual file you’re trying to load?

Does the query complete when you don’t enable reasoning or is it just when you enable reasoning?


(Mahsa87) #8

Thanks for your reply!
I managed to upload my ttl file on Stardog (It couldn’t upload it because there was a mistake in the file that made the file out of standard), but still my query doesn’t take the ttl file into account while reasoning!

I’m quite confused with how Stardog reason over my rules?
Does it reason over my swrl (as I defined them in Protege) which is already included in the owl file (my main schema)? If this is the case, I should be getting the result, and since I’m not getting it, am I correct to assume there’s something wrong with my swrl definition?

Or do I have to put my rules in a separate file? (if yes, SWRL or Stardog format?) and how am I suppose to tell Stardog to use that separate file as my rules? Does the icv add command help?

I apologize if my questions are boring for you!
Many thanks!


(zachary.whitley) #9

No worries, I’m happy to help. ICV is a different thing so you don’t need to worry about that now but is definitely worth checking out once you get you immediate problem solved. There’s no need for a separate file. Your rules and ontology is loaded into the database right along with your data. There is no separate channel for loading your rules/ontology. Stardog will look into your database and pull out what it needs.

I suspect you’ve got something wrong in your rules. If you can include what your loading I could let you know although I’m not quite sure why it would lead to a query not completing.


(system) #10

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.