-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathkidehen-ifp-reasoning-test.sql
102 lines (75 loc) · 2.84 KB
/
kidehen-ifp-reasoning-test.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
-- Cleanup
SPARQL
CLEAR GRAPH <http://xmlns.com/foaf/0.1/> ;
SPARQL
CLEAR GRAPH <urn:kidehen:ifp:demo> ;
DELETE
FROM sys_rdf_schema
WHERE RS_NAME = 'urn:ifp:inference:rule' ;
SPARQL
DEFINE get:soft "no-sponge"
LOAD <http://xmlns.com/foaf/0.1/> ;
-- Adding IFP Relations to Named Graph to be used for Inference Rule
SPARQL
PREFIX lod: <http://lod.openlinksw.com/>
PREFIX schema: <http://schema.org/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
INSERT DATA INTO <urn:ifp:inference:rule:tbox:data> {
foaf:mbox a owl:InverseFunctionalProperty ;
rdfs:subPropertyOf lod:ifp_like .
foaf:homepage a owl:InverseFunctionalProperty ;
rdfs:subPropertyOf lod:ifp_like .
schema:sameAs a owl:InverseFunctionalProperty ;
rdfs:subPropertyOf lod:ifp_like .
schema:mainEntityOfPage a owl:InverseFunctionalProperty ;
rdfs:subPropertyOf lod:ifp_like .
schema:uri a owl:InverseFunctionalProperty ;
rdfs:subPropertyOf lod:ifp_like .
dcterms:identifier a owl:InverseFunctionalProperty ;
rdfs:subPropertyOf lod:ifp_like .
} ;
-- Make Rule
RDFS_RULE_SET
(
'urn:ifp:inference:rule' ,
'urn:ifp:inference:rule:tbox:data'
) ;
-- Verify Rule Creation
SELECT RS_NAME
FROM sys_rdf_schema
WHERE RS_NAME = 'urn:ifp:inference:rule' ;
-- Instance Data (ABox)
SPARQL
INSERT DATA INTO <urn:kidehen:ifp:demo>
{
<#kidehen>
# a foaf:Person;
foaf:mbox <mailto:[email protected]> ;
schema:name "Kingsley Idehen" ;
foaf:nick "kidehen".
<https://twitter.com/kidehen#this>
# a foaf:Person;
foaf:mbox <mailto:[email protected]> ;
schema:name "Kingsley Idehen" ;
schema:sameAs <https://twitter.com/kidehen/> ;
foaf:nick "@kidehen".
<https://www.linkedin.com/in/kidehen#this>
# a foaf:Person;
foaf:mbox <mailto:[email protected]> ;
schema:name "Kingsley Uyi Idehen" ;
schema:sameAs <https://www.linkedin.com/in/kidehen/> ;
foaf:nick "@kidehen".
<#kidehen> owl:sameAs <https://twitter.com/kidehen#this>, <https://www.linkedin.com/in/kidehen#this> .
} ;
-- Test 1
SPARQL
DEFINE input:inference 'urn:ifp:inference:rule'
SELECT DISTINCT <#kidehen> AS ?s ?p ?o
FROM <urn:kidehen:ifp:demo>
WHERE { <#kidehen> ?p ?o } ;
-- Test 2
SPARQL
DEFINE input:same-as "yes"
SELECT DISTINCT <#kidehen> AS ?s ?p ?o
FROM <urn:kidehen:ifp:demo>
WHERE { <#kidehen> ?p ?o }