swrl

0 views
Skip to first unread message

lolost...@gmail.com

unread,
May 3, 2013, 5:02:10 AM5/3/13
to sta...@clarkparsia.com
Hi,

I tried to use swrl reasoning  with 1.2.1 with very simple rule :


f1(?x, ?v), add(?res, 1.0f, ?v) -> f2(?x, ?res)

but when I query the database with :

stardog query  "testRulesDB;reasoning=QL" "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT  ?x  ?z
WHERE { ?x :f2 ?z }"

there is no result.

I join the ttl file.

Cheers

Laurent
rules.ttl

Mike Grove

unread,
May 3, 2013, 12:42:22 PM5/3/13
to stardog
Using Stardog 1.2, your input data, and this program [1] I get a single result:


Which as far as I know, is the correct answer.

We noticed that with 1.1.x your input file fails to parse due to what appears to be a bug in the Sesame parser.  You should double check the contents of testRulesDB to verify what's in there.

Cheers,



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

Laurent Pierre

unread,
May 3, 2013, 12:54:57 PM5/3/13
to sta...@clarkparsia.com
Very strange that I don't get the same result with the command line.  Since I get the good result for property f1, it looks like that it didn't do any reasoning … could it be that ?

Cheers

Laurent

Kendall Clark

unread,
May 3, 2013, 12:55:37 PM5/3/13
to stardog
Are you using 1.2.x?

Cheers,
Kendall

Laurent Pierre

unread,
May 3, 2013, 12:58:03 PM5/3/13
to sta...@clarkparsia.com
1.2.1, the one I downloaded yesterday

Kendall Clark

unread,
May 3, 2013, 1:16:29 PM5/3/13
to stardog
Works for us w/ 1.2.1, both command line and programmatically.

Did you recreate the DB in 1.2.1 or use the (perhaps empty) db from 1.1.x?

Cheers,
Kendall

Laurent Pierre

unread,
May 3, 2013, 1:21:14 PM5/3/13
to sta...@clarkparsia.com
Yes I recreated the DB with the script :

./stardog-admin db drop -n testRulesDB
./stardog-admin db create -n testRulesDB
./stardog data add -u admin -p admin testRulesDB  /Users/laurentpierre/Documents/dev/ontologies/test/rules.ttl


Cheers

Laurent

Mike Grove

unread,
May 3, 2013, 1:26:01 PM5/3/13
to stardog
I'm able to get the correct results on the command line (in addition to the program I already sent) bulk loading [1] and via drop & create as you've just shown [2].

Make sure you're using the same input we are and double check the contents of testRulesDB.

Cheers,

Laurent Pierre

unread,
May 3, 2013, 1:42:10 PM5/3/13
to sta...@clarkparsia.com
Great it works now … but when I try a new example :

f1(?x, ?v), add(?foo1, 1.0f, ?v), multiply(?foo2, 2.0f, ?foo1), subtract(?res, 6.0f, ?foo2) -> f2(?x, ?res)

I get  '-16.0' instead of '16.0' 

Laurent Pierre

unread,
May 3, 2013, 1:43:14 PM5/3/13
to sta...@clarkparsia.com
I join the file :

rules.ttl

Mike Grove

unread,
May 3, 2013, 1:55:50 PM5/3/13
to stardog
On Fri, May 3, 2013 at 1:42 PM, Laurent Pierre <lolost...@gmail.com> wrote:
Great it works now … but when I try a new example :

f1(?x, ?v), add(?foo1, 1.0f, ?v), multiply(?foo2, 2.0f, ?foo1), subtract(?res, 6.0f, ?foo2) -> f2(?x, ?res)

I get  '-16.0' instead of '16.0' 

You get -16 because that's the right answer:

?v = 10
?foo = 1 + ?v = 1 + 10 = 11
?foo2 = 2 * ?foo1 = 2 * 11 = 22
?res = 6 - ?foo2 = 6 - 22 = -16

This is awkwardly defined in the SWRL spec, section 8.2 [1]:

"Satisfied iff the first argument is equal to the arithmetic difference of the second argument minus the third argument."

Basically, firstArg = secondArg - thirdArg.  Which is why the correct answer is -16 rather than 16.  All of the math built-ins in SWRL assume this ordering, ie divide(?z, ?x, ?y) means ?z = ?x / ?y.  Hopefully that clears it up.

Cheers,

Mike

Laurent Pierre

unread,
May 3, 2013, 2:00:21 PM5/3/13
to sta...@clarkparsia.com
Thank you


Laurent

Envoyé du LoloPhone
Reply all
Reply to author
Forward
0 new messages