Built-in support for SWRL

23 views
Skip to first unread message

an...@socure.me

unread,
Apr 15, 2013, 3:54:58 AM4/15/13
to sta...@clarkparsia.com
Hi,

I am new to Stardog. I would like to know whether Stardog supports for automatic inference where inference is done while data is being stored rater than loading the model to either jena/sesame and then performing the inference which causes the performance issue when the data grows.

I would be happy if anyone could explain me how to add swrl rule to Stardog for automatic rule execution.

Thanks
Anand

Mike Grove

unread,
Apr 15, 2013, 8:04:06 AM4/15/13
to stardog
On Mon, Apr 15, 2013 at 3:54 AM, <an...@socure.me> wrote:
Hi,

I am new to Stardog. I would like to know whether Stardog supports for automatic inference where inference is done while data is being stored rater than loading the model to either jena/sesame and then performing the inference which causes the performance issue when the data grows.

Stardog performs reasoning at query time, not load time.  Support for the Jena/Sesame APIs are unrelated; nothing is loaded into them, they're merely querying Stardog directly behind the scenes.
 

I would be happy if anyone could explain me how to add swrl rule to Stardog for automatic rule execution.

Simply use them.  There's nothing special you need to do to enable SWRL, or reasoning for that matter.  Just add SWRL rules, open a connection specifying a reasoning type (QL, EL, RL) and you're all set.  If you want to stop using SWRL, just delete the rules.

Cheers,

Mike
 

Thanks
Anand

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

Anand Raj

unread,
Apr 15, 2013, 8:22:21 AM4/15/13
to sta...@clarkparsia.com
Hi Mike,

Thanks for your prompt reply. I went through the PetStore example where I can learn storing the data to Stardog and fetch using SPARQL. Could you also provide examples how can i add the SWRL rules to Stardog and query the inferenced results using SPARQL.

Thanks
Anand

Mike Grove

unread,
Apr 15, 2013, 8:27:15 AM4/15/13
to stardog
You can learn about SWRL here [1], the easiest way to get SWRL into Stardog is via its RDF serialization [2].  Further I suggest you read the Stardog documentation [3] on its reasoning capabilities.  Lastly, examples of how to use Stardog are included in the distribution, including a good example of how to use Stardog's reasoning capabilities.

Cheers,

Anand Raj

unread,
Apr 17, 2013, 12:47:15 PM4/17/13
to sta...@clarkparsia.com
Hi Mike,

Thanks for your study material.

Please find the attached ontology.

I have 4 instances of type Person, anil, bob, kamal and tony. Their age are respectively 17, 18, 20 and 21.

now, i have the rule, Person(?x), age(?x, ?y), greaterThanOrEqual(?y, 18) -> Adult(?x)

then, i have created the database in stardog and stored this owl data.
stardog-admin create -n test -t D -u admin -p admin --server snarl://localhost:5820/ examples/data/stardogreasoning.owl

Executing the query
stardog query -c "http://localhost:5822/test;reasoning=QL" -q "SELECT DISTINCT ?s WHERE { ?s rdf:type reasoning:Adult } LIMIT 10"

When I execute this query. bob, kamal and tony should be type of Adult. But this doesn't happen.

Am I doing anything wrong?

Please advise me on this.

Thanks
Anand

stardogreasoning.owl

Mike Grove

unread,
Apr 18, 2013, 9:46:59 AM4/18/13
to stardog
On Wed, Apr 17, 2013 at 12:47 PM, Anand Raj <an...@socure.me> wrote:
Hi Mike,

Thanks for your study material.

Please find the attached ontology.

I have 4 instances of type Person, anil, bob, kamal and tony. Their age are respectively 17, 18, 20 and 21.

now, i have the rule, Person(?x), age(?x, ?y), greaterThanOrEqual(?y, 18) -> Adult(?x)

then, i have created the database in stardog and stored this owl data.
stardog-admin create -n test -t D -u admin -p admin --server snarl://localhost:5820/ examples/data/stardogreasoning.owl

Executing the query
stardog query -c "http://localhost:5822/test;reasoning=QL" -q "SELECT DISTINCT ?s WHERE { ?s rdf:type reasoning:Adult } LIMIT 10"

When I execute this query. bob, kamal and tony should be type of Adult. But this doesn't happen.

Am I doing anything wrong?

No, you're correct, the answer to the query should be bob, tony & kamal.

There is unfortunately a bug in the SWRL execution for some builtins, greaterThan/greaterThanOrEqual among them, which results in the wrong answer.

This is fixed and will be included in the next release.

Thanks for reporting.

Cheers,

Mike

Anand Raj

unread,
Apr 20, 2013, 5:01:48 AM4/20/13
to sta...@clarkparsia.com
Thanks. When can I expect the next release?

How would be performance when the data grows to millions of triples.

Thanks
Anand

Kendall Clark

unread,
Apr 20, 2013, 11:08:20 AM4/20/13
to stardog


On Apr 20, 2013 5:01 AM, "Anand Raj" <an...@socure.me> wrote:
>
> Thanks. When can I expect the next release?
>

Sometime this coming week.

> How would be performance when the data grows to millions of triples.
>

Good, typically.

Cheers,
Kendall

Anand Raj

unread,
Apr 22, 2013, 12:31:43 AM4/22/13
to sta...@clarkparsia.com
Awaiting for the next release. Please keep me updated.

Thanks
Anand

Anand Raj

unread,
Apr 29, 2013, 11:47:54 AM4/29/13
to sta...@clarkparsia.com
Awaiting for next release. We are badly waiting for the next release where the interference is done at the query time (SWRL greater/lesser Than Issue).

Please keep me updated.

Thanks
Anand

Mike Grove

unread,
Apr 29, 2013, 12:09:15 PM4/29/13
to stardog
On Mon, Apr 29, 2013 at 11:47 AM, Anand Raj <an...@socure.me> wrote:
Awaiting for next release. We are badly waiting for the next release where the interference is done at the query time (SWRL greater/lesser Than Issue).

That fix is available in v1.2 which we released last week.

Cheers,

Mike

heiner.r...@googlemail.com

unread,
Jul 24, 2013, 1:50:24 AM7/24/13
to sta...@clarkparsia.com
I am trying to work with the mathematical builtins of SWRL. I had some problems to get it running...

I decided to start with reproducing the issue as described in this thread and couldn't get this example running on stardog 1.2.3. either.


The CLI seems to have changed a bit. So I did it the following way:

1)
I created a database using:
stardog-admin db create -n test stardogreasoning.owl

2)
I queried the database with this query with reasoning=QL: (I also tried DL EL RL)
SELECT ?s WHERE { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.semanticweb.org/stardog/reasoning#Adult> }

using wget:
wget --header='accept: application/sparql-results+json' -O - 'http://admin:ad...@127.0.0.1:5822/test;reasoning=QL/query?query=SELECT%20%3Fs%20WHERE%20%7B%20%3Fs%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23type%3E%20%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fstardog%2Freasoning%23Adult%3E%20%7D'

I got an empty result.

What could be the problem there? Thank you













 

Mike Grove

unread,
Jul 24, 2013, 6:55:46 AM7/24/13
to stardog
You are passing in the reasoning level incorrectly, connection parameters should be passed in via a header:

--header="SD-Connection-String: reasoning=QL"

You might find the documentation [1] on the HTTP protocol useful.

Cheers,

Mike

Reply all
Reply to author
Forward
0 new messages