SPARQL-Query using Reasoning reveals objects when it should not

2 views
Skip to first unread message

Sven Osterwalder

unread,
Jan 17, 2015, 10:52:56 AM1/17/15
to sta...@clarkparsia.com
Hello,

As mentioned in another ticket, we are using Stardog 2.2.4 (community edition) in the context o
 our bachelor thesis and think we stumbled upon some bug when trying
 to reach a conclusion based on SWRL-rules.

Hereinafter a simplified version of the situation.

We defined the dataProperty

requires

with a certain range, which is a list of strings

{"a", "b", "c"}

Furthermore we defined the dataProperties

foos
bars

which are of boolean value, e.g.

{"true", "false"}


Based on these dataProperties, we defined the following rules

Rule: requires(?x, "a") -> foos(?x, "true")
Rule: requires(?x, "b") -> bars(?x, "true")

We then created two individuals (e.g. "x" and "y" within the same class (e.g. "Thing")
and set the dataProperties:

x requires "a"
y requires "b"

If we query the database for those properties, we can see the enriched data, e.g.:

x foos true
y bars true

When we perform a query which invokes _both_ of the properties, e.g.

SELECT
    *
WHERE {
    ?obj :foos true.
    ?obj :bars true.
}

We get both objects (x and y) as result.
This should, in our humble opinion, not happen, as SPARQL performs a conjunction
on the conditions and there is no object which satisfies the condition to have both
properties set to true.

We then deleted the rules and assigned the properties directly. If we perform
the above query now, no result is returned, which is correct. If we comment one
or the other condition out, we receive the corresponding object.

We did all the modeling (including the definition of rules and so on) within Stanford Protégé (5.0.0 build beta-15 resp. build beta-16), exported the ontology as RDF/XML
and imported it within Stardog. We dropped and re-created the database every time.

The expected conclusion, as described in the first scenario, is reached within Protégé, in which we use Pellet for reasoning as well. Therefeore
we assume it has to be an issue within Stardog, and not the reasoning.

I attached our current ontology as OWL-file. The original query (the one using the rules) is:
SELECT
    *
WHERE {
  ?obj :action true.
  ?obj :wellness true.
}

The query for querying the attributes directly (without using the rules) is:
SELECT
    *
WHERE {

    ?obj :foos true.
    ?obj :bars true.

}


Any help is kindly appreciated. If you have any questions or if we shall provide further data, we are at disposal at any time.


Yours faithfully,

Sven Osterwalder
reiseplaner_bugtest.owl

Héctor Pérez-Urbina

unread,
Jan 19, 2015, 11:00:06 AM1/19/15
to stardog
Hello,

I tried the simplified example you provided with 2.2.4 and everything worked as expected:

Hectors-MacBook-Pro:stardog-2.2.4 hector$ ./bin/stardog query "rules;reasoning=SL" "SELECT * {?s <http://www.example.org/rules#foos> true . }"
+-------+
|   s   |
+-------+
| :x    |
+-------+

Query returned 1 results in 00:00:00.109
Hectors-MacBook-Pro:stardog-2.2.4 hector$ ./bin/stardog query "rules;reasoning=SL" "SELECT * {?s <http://www.example.org/rules#bars> true . }"
+-------+
|   s   |
+-------+
| :y    |
+-------+

Query returned 1 results in 00:00:00.058
Hectors-MacBook-Pro:stardog-2.2.4 hector$ ./bin/stardog query "rules;reasoning=SL" "SELECT * {?s <http://www.example.org/rules#foos> true; <http://www.example.org/rules#bars> true . }"
+-------+
|   s   |
+-------+
+-------+

Query returned 0 results in 00:00:00.103

I attached the small ontology I used so you can compare it with the types of rule you use in your ontology.

Let us know if you have any questions.

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en



--
Best,
Héctor
testrules.ttl

Sven Osterwalder

unread,
Jan 28, 2015, 2:19:59 AM1/28/15
to sta...@clarkparsia.com, hec...@clarkparsia.com
Hello Hector,

We are very sorry, but it seems as we tried the examples only with 2.2.2 and not 2.2.4, as we had the versions installed with symlinks.
We tested your example as well as the original ontology yesterday with 2.2.4 and everything
worked as expected.

Thank you very much for your effort and feedback.


Yours,

Sven
Reply all
Reply to author
Forward
0 new messages