Skip to content

Commit 37ec00e

Browse files
committed
Sparql query to demo exercising reasoner.
Include expected output in readme.
1 parent c5d5393 commit 37ec00e

3 files changed

Lines changed: 39 additions & 20 deletions

File tree

acceptable.sparql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SELECT ?subject
2+
WHERE {
3+
?subject rdf:type think-pudding:AcceptableCandidate
4+
}

minimal.owl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@
4444

4545

4646

47-
<!-- http://example.com/think-pudding#hasAColor -->
47+
<!-- http://example.com/think-pudding#hasColor -->
4848

49-
<owl:ObjectProperty rdf:about="http://example.com/think-pudding#hasAColor">
49+
<owl:ObjectProperty rdf:about="http://example.com/think-pudding#hasColor">
5050
<rdfs:subPropertyOf rdf:resource="http://www.w3.org/2002/07/owl#topObjectProperty"/>
5151
<rdfs:range>
5252
<owl:Restriction>
53-
<owl:onProperty rdf:resource="http://example.com/think-pudding#hasAColor"/>
53+
<owl:onProperty rdf:resource="http://example.com/think-pudding#hasColor"/>
5454
<owl:someValuesFrom rdf:resource="http://example.com/think-pudding#Color"/>
5555
</owl:Restriction>
5656
</rdfs:range>
@@ -117,7 +117,7 @@
117117

118118
<owl:NamedIndividual rdf:about="http://example.com/think-pudding#Foo">
119119
<rdf:type rdf:resource="http://example.com/think-pudding#Candidate"/>
120-
<hasAColor rdf:resource="http://example.com/think-pudding#Red"/>
120+
<hasColor rdf:resource="http://example.com/think-pudding#Red"/>
121121
</owl:NamedIndividual>
122122

123123

@@ -129,7 +129,7 @@
129129
<rdf:type rdf:resource="http://example.com/think-pudding#Color"/>
130130
<rdf:type>
131131
<owl:Restriction>
132-
<owl:onProperty rdf:resource="http://example.com/think-pudding#hasAColor"/>
132+
<owl:onProperty rdf:resource="http://example.com/think-pudding#hasColor"/>
133133
<owl:someValuesFrom rdf:resource="http://example.com/think-pudding#Color"/>
134134
</owl:Restriction>
135135
</rdf:type>
@@ -169,7 +169,7 @@
169169
<rdf:first>
170170
<rdf:Description>
171171
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
172-
<swrl:propertyPredicate rdf:resource="http://example.com/think-pudding#hasAColor"/>
172+
<swrl:propertyPredicate rdf:resource="http://example.com/think-pudding#hasColor"/>
173173
<swrl:argument1 rdf:resource="http://example.com/think-pudding#c"/>
174174
<swrl:argument2 rdf:resource="http://example.com/think-pudding#Red"/>
175175
</rdf:Description>

readme.md

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,41 @@
11
# Think Pudding
2-
A minimal proof of concept reasoner example.
2+
A minimal proof of concept reasoner and ontology example.
33

44
## Description
5-
The minimal.owl ontology is rdf/xml formatted, and contains a single SWRL rule/
6-
That rule specifies that a Candidate that hasColor(Red) is an acceptable Candidate.
5+
The minimal.owl ontology is rdf/xml formatted, and contains a single SWRL rule.
6+
That rule specifies that a Candidate that hasColor(Red) is an AcceptableCandidate.
7+
```
8+
Candidate(?c) ^ hasColor(?c, Red) -> AcceptableCandidate(?c)
9+
```
710
There is a named individual Color "Red".
811
The named individual candidate "Foo".
912
Foo hasColor Red in this ontology, and reasoners should infer that Foo is an AcceptableCandidate.
1013

1114
## Use
1215

13-
### OwlTools Command Line
14-
15-
```
16-
owltools minimal.owl --reasoner hermit --run-reasoner --assert-implied
17-
```
18-
1916
### StarDog Command Line
20-
2117
Start up & demonstrate
2218
```
2319
# Start server and create database
2420
stardog-admin server start
2521
stardog-admin db create -n 'mydb' minimal.owl
2622
27-
# Query without reasoning
28-
stardog query mydb "select distinct * where { ?s ?p ?o } limit 10"
23+
# Query without reasoning will return no results
24+
stardog query mydb acceptable.sparql
2925
30-
# Query with reasoning
31-
stardog query mydb "select distinct * where { ?s ?p ?o } limit 10"
26+
# +---------+
27+
# | subject |
28+
# +---------+
29+
# +---------+
30+
31+
# Query with reasoning will return single result, :Foo
32+
stardog query --reasoning acceptable.sparql
33+
34+
# +---------+
35+
# | subject |
36+
# +---------+
37+
# | :Foo |
38+
# +---------+
3239
```
3340

3441
Cleanup & shutdown
@@ -37,6 +44,14 @@ stardog-admin db drop mydb
3744
stardog-admin server stop
3845
```
3946

47+
### OwlTools Command Line
48+
The owltools does not make the inference that Foo is an AcceptableCandidate.
49+
50+
```
51+
owltools minimal.owl --reasoner hermit --run-reasoner --assert-implied
52+
```
53+
54+
4055
## Requirements
4156
- owltools
4257
- StarDog Community

0 commit comments

Comments
 (0)