Problem with SWRL rules

5 views
Skip to first unread message

antonio garrote

unread,
Apr 5, 2013, 4:10:47 AM4/5/13
to sta...@clarkparsia.com
Hi.

I'm testing Stardog support for SWRL using the HTTP interface and I'm finding problems with some types of rules.

For example. With an empty data base. I store the following graph:

@prefix : <http://grel.org/vocabulary#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://grel.org/ids/id/eb1aa948813c5ed3e8d735449e705db2> :name "Leonor" .
<http://grel.org/ids/id/eb1aa948813c5ed3e8d735449e705db2> :age "93"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://grel.org/ids/id/eb1aa948813c5ed3e8d735449e705db2> :hasBrother <http://grel.org/ids/id/12c7af9feb05436e04509ccadc314a23> .
<http://grel.org/ids/id/12c7af9feb05436e04509ccadc314a23> :name "Santiago" .
<http://grel.org/ids/id/5b69adfadcef3ac71dcad2ed6958771a> :name "Juliana" .
<http://grel.org/ids/id/5b69adfadcef3ac71dcad2ed6958771a> :age "67"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://grel.org/ids/id/5b69adfadcef3ac71dcad2ed6958771a> :hasParent <http://grel.org/ids/id/eb1aa948813c5ed3e8d735449e705db2> .
<http://grel.org/ids/id/7f2c736d084ecc64763463d64c11ccd6> :name "Antonio" .
<http://grel.org/ids/id/7f2c736d084ecc64763463d64c11ccd6> :hasParent <http://grel.org/ids/id/5b69adfadcef3ac71dcad2ed6958771a> .

Then I store this very simple rule (:status, ?x1, "retired") <- (:age, ?x1, ?age), (swrlb:greaterThan ?age, 65) in the data base schema:

<rdf:RDF xml:base="http://grel.org/vocabulary#"
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:owl="http://www.w3.org/2002/07/owl#"
         xmlns:swrl="http://www.w3.org/2003/11/swrl#"
         xmlns:ruleml="http://www.w3.org/2003/11/swrl">

  <swrl:Variable rdf:about="http://www.w3.org/2003/11/swrl#x1"></swrl:Variable>
  <swrl:Variable rdf:about="http://www.w3.org/2003/11/swrl#age"></swrl:Variable>

  <swrl:Imp rdf:ID="test1">
    <swrl:body>
            <swrl:AtomList>
                <rdf:first>
          <swrl:DatavaluedPropertyAtom>
            <swrl:propertyPredicate rdf:resource="http://grel.org/vocabulary#age"/>
            <swrl:argument1 rdf:resource="http://www.w3.org/2003/11/swrl#x1" />
            <swrl:argument2 rdf:resource="http://www.w3.org/2003/11/swrl#age" />
          </swrl:DatavaluedPropertyAtom>
        </rdf:first>
        <rdf:rest>
          <swrl:AtomList>
            <rdf:first>
              <swrl:BuiltinAtom>
                <swrl:builtin rdf:resource="http://www.w3.org/2003/11/swrlb#greaterThan"/>
                <swrl:arguments>
                  <rdf:List>
                    <rdf:first rdf:resource="http://www.w3.org/2003/11/swrl#age"/>
                    <rdf:rest>
                      <rdf:List>
                        <rdf:first rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">65</rdf:first>
                        <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
                      </rdf:List>
                    </rdf:rest>
                  </rdf:List>
                </swrl:arguments>
              </swrl:BuiltinAtom>
            </rdf:first>
            <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
          </swrl:AtomList>
        </rdf:rest>
      </swrl:AtomList>
    </swrl:body >
    <swrl:head>
            <swrl:AtomList>
                <rdf:first>
          <swrl:DatavaluedPropertyAtom>
            <swrl:propertyPredicate rdf:resource="http://grel.org/vocabulary#status"/>
            <swrl:argument1 rdf:resource="http://www.w3.org/2003/11/swrl#x1" />
            <swrl:argument2 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">retired</swrl:argument2>
          </swrl:DatavaluedPropertyAtom>
        </rdf:first>
        <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
      </swrl:AtomList>
    </swrl:head>
  </swrl:Imp>
</rdf:RDF>


If I try to query the graph using a SPARQL query with the property from the head of the rule, I'm getting a 500 HTTP error with empty body:

 -----------------------
QUERYING SELECT...
SELECT ?S  ?O WHERE { ?S <http://grel.org/vocabulary#status> ?O }
----------------------
ARGUMENTS:
{:method=>:get,
 :url=>"http://localhost:5822/testgraph/query?query=SELECT+%3FS++%3FO+WHERE+%7B+%3FS+%3Chttp%3A%2F%2Fgrel.org%2Fvocabulary%23status%3E+%3FO+%7D",
 :headers=>{:accept=>"application/sparql-results+json",
                    "SD-Connection-String"=>"reasoning=QL",
                   :content_type=>"application/json"},
 :user=>"admin",
 :password=>"admin",
 :payload=>"null"}

RESPONSE:
status: 500
---
headers: {:connection=>"close", :server=>"Jetty(6.1.21)"}
---
body:
-----------------------

Queries work perfectly if I avoid the property in the rule, e.g SELECT ?S ?O WHERE { ?S ?P ?O }.
I'm fairly new to SWRL so I'm afraid I'm doing something obvious wrong.
I would be grateful for any help.

Cheers.

Mike Grove

unread,
Apr 5, 2013, 2:42:04 PM4/5/13
to stardog
This appears to be a bug in how we're translating swrl:greaterThan into a query at runtime.

Thanks for reporting this, it will be fixed in the next release.

Cheers,

Mike



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

Reply all
Reply to author
Forward
0 new messages