Sub-Property / Inverse-Property Reasoning for Abox data

1 view
Skip to first unread message

john....@gmail.com

unread,
Jun 12, 2014, 12:58:40 PM6/12/14
to sta...@clarkparsia.com
Version 2.1.3

I think this issue is related to a previous issue:
https://groups.google.com/a/clarkparsia.com/d/msg/stardog/glBE4x5lY8A/qvxTo4NUXKgJ
"Owl Properties RL Reasoning Bug? version 2"
(Has there been any update on this? The issue is still present in 2.1.3)



As far as I can tell there is no Sub-Property or Inverse reasoning happening for ABox data.
See attached test case:
The data:
>>>>>>>>>>>>>>>>>>>
@prefix base: <http://a.b.c/Ont1#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix stardog: <tag:stardog:api:> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://a.b.c/Ont1> {
   
<http://a.b.c/Ont1> a owl:Ontology .
   
   
base:T a owl:ObjectProperty .
   
   
base:R a owl:ObjectProperty .
   
   
base:P a owl:ObjectProperty ;
        rdfs
:subPropertyOf base:R ;
        rdfs
:range base:Ob ;
        rdfs
:domain base:Sub .
   
   
base:Ob a owl:Class .
   
   
base:Sub a owl:Class .
   
   
base:PP a owl:ObjectProperty ;
        rdfs
:subPropertyOf base:P ;
        rdfs
:range base:Ob ;
        rdfs
:domain base:Sub .
   
   
base:PPP a owl:ObjectProperty ;
        rdfs
:subPropertyOf base:PP ;
        rdfs
:range base:Ob ;
        rdfs
:domain base:Sub .
   
   
base:Q a owl:ObjectProperty ;
        owl
:inverseOf base:P .
   
   
base:QQ a owl:ObjectProperty ;
        rdfs
:subPropertyOf base:Q ;
        owl
:inverseOf base:PP .
   
   
base:QQQ a owl:ObjectProperty ;
        rdfs
:subPropertyOf base:QQ ;
        owl
:inverseOf base:PPP .
   
   
base:o1 a base:Ob , owl:NamedIndividual .
   
   
base:o2 a base:Ob , owl:NamedIndividual .
   
   
base:o3 a base:Ob , owl:NamedIndividual .
   
   
base:s1 a base:Sub , owl:NamedIndividual ;
       
base:PPP base:o1 .
   
   
base:s2 a base:Sub , owl:NamedIndividual ;
       
base:PPP base:o2 .
   
   
base:s3 a base:Sub , owl:NamedIndividual ;
       
base:T base:o3 ;
       
base:PPP base:o3 .
}

<<<<<<<<<<<<<<<<<<<<<<<<<

The query:
>>>>>>>>>>>>>>>>>>>
PREFIX base: <http://a.b.c/Ont1#>                                            
PREFIX rdfs
: <http://www.w3.org/2000/01/rdf-schema#>                
PREFIX owl
: <http://www.w3.org/2002/07/owl#>                        
PREFIX rdf
: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>            
PREFIX
base: <http://a.b.c/Ont1#>                                            
                                                             
SELECT
?g1 ?g2 ?s ?p ?o                                    
 FROM  
<http://a.b.c/Ont1>                                            
 WHERE  
{                                                    
     GRAPH
<http://a.b.c/Ont1> {                                        
           
?p a owl:ObjectProperty .                            
          OPTIONAL
{                                            
               
?p rdfs:subPropertyOf base:R .                    
               
?s ?p ?o .                                        
         
}                                                    
     
}                                                        
 
}                  
<<<<<<<<<<<<<<<<<<<<<<<<<

The Results:
>>>>>>>>>>>>>>>>>>>
0: [p=http://www.w3.org/2002/07/owl#topObjectProperty]
1: [p=http://a.b.c/Ont1#Q]
2: [p=http://a.b.c/Ont1#QQ]
3: [p=http://a.b.c/Ont1#QQQ]
4: [p=http://www.w3.org/2002/07/owl#bottomObjectProperty]
5: [p=http://a.b.c/Ont1#QQQ]
6: [p=http://a.b.c/Ont1#T]
7: [p=http://a.b.c/Ont1#R]
8: [p=http://a.b.c/Ont1#P]
9: [p=http://a.b.c/Ont1#PP]
10: [p=http://a.b.c/Ont1#PPP;s=http://a.b.c/Ont1#s1;o=http://a.b.c/Ont1#o1]
11: [p=http://a.b.c/Ont1#PPP;s=http://a.b.c/Ont1#s1;o=http://a.b.c/Ont1#o1]
12: [p=http://a.b.c/Ont1#PPP;s=http://a.b.c/Ont1#s2;o=http://a.b.c/Ont1#o2]
13: [p=http://a.b.c/Ont1#PPP;s=http://a.b.c/Ont1#s2;o=http://a.b.c/Ont1#o2]
14: [p=http://a.b.c/Ont1#PPP;s=http://a.b.c/Ont1#s3;o=http://a.b.c/Ont1#o3]
15: [p=http://a.b.c/Ont1#PPP;s=http://a.b.c/Ont1#s3;o=http://a.b.c/Ont1#o3]
16: [p=http://a.b.c/Ont1#PPP;s=http://a.b.c/Ont1#s1;o=http://a.b.c/Ont1#o1]
17: [p=http://a.b.c/Ont1#PPP;s=http://a.b.c/Ont1#s1;o=http://a.b.c/Ont1#o1]
18: [p=http://a.b.c/Ont1#PPP;s=http://a.b.c/Ont1#s2;o=http://a.b.c/Ont1#o2]
19: [p=http://a.b.c/Ont1#PPP;s=http://a.b.c/Ont1#s2;o=http://a.b.c/Ont1#o2]
20: [p=http://a.b.c/Ont1#PPP;s=http://a.b.c/Ont1#s3;o=http://a.b.c/Ont1#o3]
21: [p=http://a.b.c/Ont1#PPP;s=http://a.b.c/Ont1#s3;o=http://a.b.c/Ont1#o3]
22: [p=http://a.b.c/Ont1#PP]
<<<<<<<<<<<<<<<<<<<<<<<<<

Also Expect:
>>>>>>>>>>>>>>>>>>>
s  p  o
---------
s1 R o1
s2 R o2
s3 R o3
s1 P o1
s2 P o2
s3 P o3
s1 PP o1
s2 PP o2
s3 PP o3
o1 Q s1
o2 Q s2
o3 Q s13
o1 QQ s1
o2 QQ s2
o3 QQ s13
o1 QQQ s1
o2 QQQ s2
o3 QQQ s13
<<<<<<<<<<<<<<<<<<<<<<<<<



InverseTest.ttl
InverseTest.java

john....@gmail.com

unread,
Jun 12, 2014, 1:03:55 PM6/12/14
to sta...@clarkparsia.com, john....@gmail.com
I get the same results with non-DL reasoning too.
I thought that this might be a DL reasoning problem, separating the tbox and abox axioms into separate graphs / contexts.
But I get the same results when I split the tbox and abox into separate contexts.

Héctor Pérez-Urbina

unread,
Jun 16, 2014, 1:54:33 PM6/16/14
to stardog, john....@gmail.com
Dear John,

I see that your TBox is also part of your named graph <http://a.b.c/Ont1>. Stardog by default extracts the TBox from the default graph. You can tell Stardog where the schema is by setting the reasoning.schema.graphs property to one or more named graph URIs [1]. Did you specify your TBox like this?


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



--
Best,
Héctor
Message has been deleted

john....@gmail.com

unread,
Jun 17, 2014, 7:26:28 AM6/17/14
to sta...@clarkparsia.com, john....@gmail.com
Actually, there was an error in the previous query ... Inverse properties would not have matched. SubProperties should have matched though.
I'll start again :-)

Option 1: Everything in one graph
Files: InverseTest.ttl and InverseTest.java
All TBox and ABox data stored in graph http://a.b.c/Ont1
reasoning.schema.graphs:  [tag:stardog:api:context:default, http://a.b.c/Ont1]

Data:
Query:
PREFIX base: <http://a.b.c/Ont1#>                                            
PREFIX rdfs
: <http://www.w3.org/2000/01/rdf-schema#>                
PREFIX owl
: <http://www.w3.org/2002/07/owl#>                        
PREFIX rdf
: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>            
PREFIX
base: <http://a.b.c/Ont1#>                                            

                                                             
SELECT
?s ?p ?o                                            
 FROM  NAMED
<http://a.b.c/Ont1>                                    

 WHERE  
{                                                    
     GRAPH
<http://a.b.c/Ont1> {                                        
           
?p a owl:ObjectProperty .                            
          OPTIONAL
{
                                           
               
?p a owl:ObjectProperty .                        
               
?s ?p ?o .                                        
         
}                                                    
     
}                                                        
 
}            

Results (Including duplicates)

0: [p=http://www.w3.org/2002/07/owl#topObjectProperty]
1: [p=R]
2: [p=PP]
3: [p=PPP;    s=s1;    o=o1]
4: [p=PPP;    s=s1;    o=o1]
5: [p=PPP;    s=s2;    o=o2]
6: [p=PPP;    s=s2;    o=o2]
7: [p=PPP;    s=s3;    o=o3]
8: [p=PPP;    s=s3;    o=o3]
9: [p=http://www.w3.org/2002/07/owl#bottomObjectProperty]
10: [p=P]
11: [p=PPP;    s=s1;    o=o1]
12: [p=PPP;    s=s1;    o=o1]
13: [p=PPP;    s=s2;    o=o2]
14: [p=PPP;    s=s2;    o=o2]
15: [p=PPP;    s=s3;    o=o3]
16: [p=PPP;    s=s3;    o=o3]
17: [p=T;    s=s3;    o=o3]
18: [p=Q]
19: [p=QQ]
20: [p=QQQ]
21: [p=QQQ]


Also Expect:

s  p  o
---------

s1 R o1
s2 R o2
s3 R o3
s1 P o1
s2 P o2
s3 P o3
s1 PP o1
s2 PP o2
s3 PP o3
o1 Q s1
o2 Q s2
o3 Q s3

o1 QQ s1
o2 QQ s2
o3 QQ s3

o1 QQQ s1
o2 QQQ s2
o3 QQQ s3





InverseTest.ttl
InverseTest.java

john....@gmail.com

unread,
Jun 17, 2014, 7:44:58 AM6/17/14
to sta...@clarkparsia.com, john....@gmail.com

Option 2: Split ABox and TBox into seperate Graphs/Contexts
Files: InverseTest_abox.ttl , InverseTest_abox.ttl and InverseTest_NamedGraphs.java
All TBox data stored in graph http://a.b.c/Ont1
All ABox data stored in graph http://a.b.c/Ont1/Values
Tried both :
reasoning.schema.graphs: [tag:stardog:api:context:default, http://a.b.c/Ont1]
and
reasoning.schema.graphs: [tag:stardog:api:context:default, http://a.b.c/Ont1, http://a.b.c/Ont1/Values]

Tried DL and QL reasoning


Data: (Same except for contexts)
@prefix base: <http://a.b.c/Ont1#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix stardog: <tag:stardog:api:> .
@prefix sub: <http://a.b.c/Ont1/Values#> .

@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://a.b.c/Ont1> {
   
<http://a.b.c/Ont1> a owl:Ontology .
   
   
base:T a owl:ObjectProperty .
   
   
base:R a owl:ObjectProperty .
   
   
base:P a owl:ObjectProperty ;
        rdfs
:subPropertyOf base:R ;
        rdfs
:range base:Ob ;
        rdfs
:domain base:Sub .
   
   
base:Ob a owl:Class .
   
   
base:Sub a owl:Class .
   
   
base:PP a owl:ObjectProperty ;
        rdfs
:subPropertyOf base:P ;
        rdfs
:range base:Ob ;
        rdfs
:domain base:Sub .
   
   
base:PPP a owl:ObjectProperty ;
        rdfs
:subPropertyOf base:PP ;
        rdfs
:range base:Ob ;
        rdfs
:domain base:Sub .
   
   
base:Q a owl:ObjectProperty ;

        rdfs
:subPropertyOf base:R ;

        owl
:inverseOf base:P .
   
   
base:QQ a owl:ObjectProperty ;
        rdfs
:subPropertyOf base:Q ;
        owl
:inverseOf base:PP .
   
   
base:QQQ a owl:ObjectProperty ;
        rdfs
:subPropertyOf base:QQ ;
        owl
:inverseOf base:PPP .
}

<http://a.b.c/Ont1/Values> {

   
base:o1 a base:Ob , owl:NamedIndividual .
   
   
base:o2 a base:Ob , owl:NamedIndividual .
   
   
base:o3 a base:Ob , owl:NamedIndividual .
   
   
base:s1 a base:Sub , owl:NamedIndividual ;
       
base:PPP base:o1 .
   
   
base:s2 a base:Sub , owl:NamedIndividual ;
       
base:PPP base:o2 .
   
   
base:s3 a base:Sub , owl:NamedIndividual ;
       
base:T base:o3 ;
       
base:PPP base:o3 .
}


Query: (Same-ish except  for named graphs)
PREFIX base: <http://a.b.c/Ont1#>                                            
PREFIX rdfs
: <http://www.w3.org/2000/01/rdf-schema#>                
PREFIX owl
: <http://www.w3.org/2002/07/owl#>                        
PREFIX rdf
: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>            
PREFIX
base: <http://a.b.c/Ont1#>                                            
                                                             
SELECT
?s ?p ?
o                                            
 FROM  
<http://a.b.c/Ont1>                                            
 FROM  
<http://a.b.c/Ont1/Values>                                            

 WHERE  
{                                                    
     GRAPH
<http://a.b.c/Ont1> {                                        
           
?p a owl:ObjectProperty .                            
     
}                                                        
      OPTIONAL
{
                                               
         GRAPH
<http://a.b.c/Ont1/Values> {                                    

               
?p a owl:ObjectProperty .                        
               
?s ?p ?o .                                        
         
}                                                    
     
}                                                        
 
}                      

 
Results (Same)(Including duplicates)
0: [p=http://www.w3.org/2002/07/owl#topObjectProperty]
1: [p=T;s=s3;o=o3]
2: [p=http://www.w3.org/2002/07/owl#bottomObjectProperty]
3: [p=R]
4: [p=P]
5: [p=PP]
6: [p=PPP;    s=s1;    o=o1]
7: [p=PPP;    s=s1;    o=o1]
8: [p=PPP;    s=s2;    o=o2]
9: [p=PPP;    s=s2;    o=o2]
10: [p=PPP;    s=s3;    o=o3]
11: [p=PPP;    s=s3;    o=o3]
12: [p=PP]
13: [p=PPP;    s=s1;    o=o1]
14: [p=PPP;    s=s1;    o=o1]
15: [p=PPP;    s=s2;    o=o2]
16: [p=PPP;    s=s2;    o=o2]
17: [p=PPP;    s=s3;    o=o3]
18: [p=PPP;    s=s3;    o=o3]
19: [p=Q]
20: [p=QQ]
21: [p=QQQ]
22: [p=QQQ]


 
Also Expect: (As before)
InverseTest_NamedGraphs.java
InverseTest_abox.ttl
InverseTest_tbox.ttl

Héctor Pérez-Urbina

unread,
Jun 18, 2014, 3:54:08 PM6/18/14
to stardog, john....@gmail.com
Dear John,

The reason this query didn't work as expected is because the current version of Stardog doesn't perform reasoning when it finds a BGP of the form ?s ?p ?o. 

The latest unreleased version, however, is able to handle BGPs of that form. I executed your query over your data and got the expected results.

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



--
Best,
Héctor

john....@gmail.com

unread,
Jun 19, 2014, 7:12:07 AM6/19/14
to sta...@clarkparsia.com, john....@gmail.com
Thanks Héctor for your reply.
I look forward to the next version.
Best regards,
John

john....@gmail.com

unread,
Jul 4, 2014, 7:40:17 AM7/4/14
to sta...@clarkparsia.com, john....@gmail.com
Hi again Hector,
Maybe I'm doing something silly, but I still get the same incomplete results for version 2.2.
Any help is greatly appreciated.
Thanks
John

Héctor Pérez-Urbina

unread,
Jul 7, 2014, 12:38:36 PM7/7/14
to stardog, John Keeney
Hi John,

I tried your query (and some slight modifications) for the case where everything is in a named graph (<http://a.b.c/Ont1#>) and I'm getting the expected results (see attached file).

The queries I tried are:

SELECT ?s ?p ?o FROM <http://a.b.c/Ont1#> {?p a owl:ObjectProperty. ?s ?p ?o.} 
(22 results)

SELECT ?s ?p ?o FROM NAMED <http://a.b.c/Ont1#> {GRAPH <http://a.b.c/Ont1#> {?p a owl:ObjectProperty. ?s ?p ?o.}}
(22 results)

SELECT ?s ?p ?o FROM <http://a.b.c/Ont1#> {?p a owl:ObjectProperty. OPTIONAL {?p a owl:ObjectProperty. ?s ?p ?o.}}
(24 results)

SELECT ?s ?p ?o FROM NAMED <http://a.b.c/Ont1#> {GRAPH <http://a.b.c/Ont1#> { ?p a owl:ObjectProperty. OPTIONAL {?p a owl:ObjectProperty. ?s ?p ?o.}}}
(24 results)

Are these results what you expect?

What is it specifically that is failing? Which query? Where's the data? Where's the TBox? What is reasoning.schema.graphs?



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



--
Best,
Héctor
out.txt

john....@gmail.com

unread,
Jul 8, 2014, 9:21:44 AM7/8/14
to sta...@clarkparsia.com, john....@gmail.com
Hi Hector,
Thanks for your reply.

I should have tested a bit more with version 2.2. Sorry.

Your queries are all QL reasoning. I cannot get DL reasoning working at all.
I understand why DL reasoning doesn't work where instance data is in the same graph/context
But I cannot seem to get it to work when the schema data is in a different context/graph than the instance data.
(I've tried with the schema data in the default context, and in a separate context with reasoning.schema.graphs set.)

I think I have attached enough information here (comparing QL and DL output) to show what I mean.
OneGraph.txt
TwoGraphs.txt

Héctor Pérez-Urbina

unread,
Jul 8, 2014, 9:34:47 AM7/8/14
to stardog
Oh, mystery solved. DL works for TBox queries only; that is, queries over the schema-part of the ontology [1].




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



--
Best,
Héctor

john....@gmail.com

unread,
Jul 8, 2014, 10:56:01 AM7/8/14
to sta...@clarkparsia.com
Thanks Hector.

Does this mean there is currently no way to do DL reasoning on a schema, and then query instance data incorporating those results? Without using one of the following :

1: Split the query into 2 queries and manually pass intermediate results (1 DL query to the schema, and a non-DL query to the instance data)?
2: Fully DL reason and materialise the schema ?
2a: Materialise the DL aspects of the Schema ?
3: Find/write appropriate rules for the DL aspects of the schema and then use SL reasoning to emulate DL reasoning (will not be complete without being schema-specific)
4: Embed DL-specific extensions in the query to emulate DL reasoning (will not be complete without being schema-specific)

Thanks,
John

Mike Grove

unread,
Jul 8, 2014, 11:44:12 AM7/8/14
to stardog
On Tue, Jul 8, 2014 at 10:56 AM, <john....@gmail.com> wrote:
Thanks Hector.

Does this mean there is currently no way to do DL reasoning on a schema, and then query instance data incorporating those results? Without using one of the following :

Correct, DL queries are only over the TBox.

What are you trying to accomplish that requires DL reasoning?  All of the other profiles can perform schema reasoning, and can be done over both the TBox and ABox, you might be able to use one of them depending on what in DL you require.

Cheers,

Mike
 

1: Split the query into 2 queries and manually pass intermediate results (1 DL query to the schema, and a non-DL query to the instance data)?
2: Fully DL reason and materialise the schema ?
2a: Materialise the DL aspects of the Schema ?
3: Find/write appropriate rules for the DL aspects of the schema and then use SL reasoning to emulate DL reasoning (will not be complete without being schema-specific)
4: Embed DL-specific extensions in the query to emulate DL reasoning (will not be complete without being schema-specific)

Thanks,
John


On Tuesday, July 8, 2014 2:34:47 PM UTC+1, Hector Perez Urbina wrote:
Oh, mystery solved. DL works for TBox queries only; that is, queries over the schema-part of the ontology [1].


Reply all
Reply to author
Forward
0 new messages