Reasoning Issue

0 views
Skip to first unread message

bsletten

unread,
Mar 12, 2014, 1:33:22 PM3/12/14
to sta...@clarkparsia.com
This Trig file is loaded into a new DB:

----
@prefix field: <http://www.example.com/fieldNames#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.

<urn:foo:bar-2014-03-11> {
<field:1>
 field:Bar "1000 ICS";
 field:FooCode "T017";
 field:FooFamily "T017/T018";
 field:Foo1 "T017201-S";
 field:Foo2 "T017201-BCS";
 field:Foo3 "T017201-D1" .

field:Foo1 rdfs:subPropertyOf field:foo .
field:Foo2 rdfs:subPropertyOf field:foo .
field:Foo3 rdfs:subPropertyOf field:foo .


{
}
----

As is, if this is run via the Web Console:

select ?s ?bar where {
 graph <urn:foo:bar-2014-03-11> {
      ?s <http://www.example.com/fieldNames#foo> ?bar
   }
}

I get no results.

If I add the Tbox statements to the default graph (and mutate the query so the Web Console doesn't think the result can be cached, that's an annoying one to look at later):

SPARQL Results
s bar
field:1 T017201-S
field:1 T017201-D1
field:1 T017201-D1

If I run this query now:

select ?s ?bar where {
 graph <urn:foo:bar-2014-03-11> {
      ?s <http://www.example.com/fieldNames#Bar> ?bar
   }
}

I get these legit results:


SPARQL Results
s bar
field:1 1000 ICS

If, however, I run this query:

select ?s ?bar ?foo where {
 graph <urn:foo:bar-2014-03-11> {
      ?s <http://www.example.com/fieldNames#Bar> ?bar ;
         <http://www.example.com/fieldNames#foo> ?foo .
   }
}

I get no results.

If I load all of the data into the default graph, I am also seeing no results for that last query. If RDFS infers that ?s field:foo ?foo based on 

<field:1>
 field:Bar "1000 ICS";
 field:FooCode "T017";
 field:FooFamily "T017/T018";
 field:Foo1 "T017201-S";
 field:Foo2 "T017201-BCS";

and 

field:Foo1 rdfs:subPropertyOf field:foo .

Shouldn't it also match the graph pattern:

 field:Bar ?bar ; field:foo ?foo 

?

Evren Sirin

unread,
Mar 13, 2014, 11:35:16 AM3/13/14
to Stardog
Hi Brian,

There were two different issues you encountered. In the first case,
the schema axioms were being ignored completely since by default
Stardog uses only the default graph for schema axioms. If you create
your database as follows the schema axioms in any graph will be taken
into account:

bin/stardog-admin db create -o "reasoning.schema.graphs=*" -n myDb myData.trig

You can set this config option after database creation using
"stardog-admin metadata set" command as well but you'll need to
offline/online db before/after.

The second issue is Stardog being very picky about untyped properties.
There is no type triple for field:Bar and it does not appear in any
schema axiom either. In such cases Stardog cannot decide if it is an
object or datatype property and it falls back to no reasoning. There
is typically a warning in the log about this though I'm not sure if it
was logged in this case. We will be improving how these reasoning
queries are handled in the future but you can use one of the following
two workarounds right now. You can just add a type triple for fieldBar
into you data:

field:Bar a owl:DatatypeProperty .

then the query should work as is. Or you can modify your query to
include the type triple in the query:

prefix field: <http://www.example.com/fieldNames#>

select ?s ?bar ?foo where {
graph <urn:foo:bar-2014-03-11> {
?s field:Bar ?bar ;
field:foo ?foo .
field:Bar a owl:DatatypeProperty .
}
}

Best,
Evren

Brian Sletten

unread,
Mar 13, 2014, 11:42:45 AM3/13/14
to sta...@clarkparsia.com
Thanks, Evrin. I had come to the conclusion about the first issue but hadn't figured out where/how to specify the graphs to the database. That property is mentioned in the documentation, but only in passing. It would be super helpful if what you just sent here was added.

I'll check and see if the logs have a note about the issue, but I trust your explanation and will give it a go. Thanks for your time.
> --
> -- --
> 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
>
> To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.

signature.asc
Reply all
Reply to author
Forward
0 new messages