More SWRL rules/reasoning help

5 views
Skip to first unread message

Peter Neorr

unread,
May 18, 2016, 2:43:35 PM5/18/16
to Stardog
Once again I'm confused by something that seems like it should be simple.  

My test ontology contains an individual that isn't explicitly a Company, but ontology axioms cause the reasoner to type it as a Company.  Another ontology rule states that any Employee with the an employerTaxId that matches any Company's taxId, should "worksFor" that Company. 

The actual rule:
Company(?c), Person(?p), employerTaxId(?p, ?id), taxId(?c, ?id) -> worksFor(?p, ?c)

My problem is that I'm not seeing the expected results:
 :DougLove :worksFor :champion 
 :Alex :worksFor :champion 
 

I'm would also expect the reasoner to conclude that Alex and Doug have coworkers, because of another rule that you all helped with earlier.  Do inferred statements lead to further inferences?    

All the pieces are there.  Why isn't the reasoner putting them together?  I've attached a screenshot and test file.  

As always,  thanks for your insights.

-Peter Neorr


petsAndPeople.ttl
worksForRule.png

Zachary Whitley

unread,
May 18, 2016, 3:51:04 PM5/18/16
to Stardog
It looks like you've got an unsupported cycle in your rule. There was a recent thread about SWRL and rule cycles you can look at for more information. If you look at your stardog.log file you should see something like the following

WARN  2016-05-18 15:30:39,138 [SPEC-Server-1-4] com.complexible.stardog.reasoning.blackout.ViewAtomToPlanNode:transformView(100): Unsupported cycle or rule for property tag:ont#worksFor
 



--
-- --
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
---
You received this message because you are subscribed to the Google Groups "Stardog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.

Zachary Whitley

unread,
May 18, 2016, 4:04:59 PM5/18/16
to Stardog
If you remove the type triples Company(?c) and Person(?p) from your rule

[]
  a rule:SPARQLRule ;
  rule:content """
    PREFIX co: <http://purl.org/co/>
    PREFIX swrlb: <http://www.w3.org/2003/11/swrlb#>
    prefix : <tag:ont#>

      IF {
        ?c :taxId ?id .
        ?p :employerTaxId ?id .
          }
      THEN {
        ?p :worksFor ?c .
          }""" .


you should get what you're looking for

$> stardog query test -r "prefix : <tag:ont#> select * where {?e1 :worksFor ?c1}" -u admin -P

+--------------------+---------------------+
|         e1         |         c1          |
+--------------------+---------------------+
| tag:ont#PeterNeorr | tag:ont#champion    |
| tag:ont#bucky      | tag:ont#pizzaplanet |
| tag:ont#denise     | tag:ont#champion    |
| tag:ont#Alex       | tag:ont#champion    |
| tag:ont#DougLove   | tag:ont#champion    |
| tag:ont#Ryan       | tag:ont#champion    |
+--------------------+---------------------+



Peter Neorr

unread,
May 18, 2016, 4:07:12 PM5/18/16
to Stardog
Thanks Zachary.  I guess I need to understand what a cycle is...  

My stardog.log doesn't usually show anything helpful, just the normal startup messages, or stack traces when things go horribly wrong.  Any clues to how I can tune this to see what you're seeing?  BTW, I'm using a Win10 machine and I see this console message every time I use a stardog command: "ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console."

Thanks
-Peter

Zachary Whitley

unread,
May 18, 2016, 4:25:04 PM5/18/16
to Stardog
It's easier to see it in the Stardog SWRL syntax but I'll try a little ascii diagram


         ?id
         /  \
:taxId  /    \ :employerTaxId
       /      \
      ?p------?c

      :worksFor


The logging problem is interesting. I don't run windows but do you have a file called log4j2.xml in $STARDOG_HOME/server/dbms and does the user running Stardog have permission to read it?
 
Reply all
Reply to author
Forward
0 new messages