-
Notifications
You must be signed in to change notification settings - Fork 5
/
built-in-inference-reasoning-inverseOf.sql
71 lines (55 loc) · 2.06 KB
/
built-in-inference-reasoning-inverseOf.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
-- Cleanup
SPARQL CLEAR GRAPH <https://www.openlinksw.com/DAV/uda2.openlinksw.com/data/turtle/multi-tier/2019/UDAMTProductFeatures.ttl> ;
SPARQL CLEAR GRAPH <urn:inference:product:feature:inverse> ;
DELETE FROM DB.DBA.SYS_RDF_SCHEMA
WHERE RS_NAME = 'urn:inference:product:feature:inverse:rule' ;
--Load Data
SPARQL
DEFINE
get:soft 'replace'
SELECT *
FROM <https://www.openlinksw.com/DAV/uda2.openlinksw.com/data/turtle/multi-tier/2019/UDAMTProductFeatures.ttl>
{
?s ?p ?o
};
SPARQL
INSERT INTO GRAPH <urn:inference:product:feature:inverse>{
<http://www.openlinksw.com/ontology/features#hasFeature> owl:inverseOf <http://www.openlinksw.com/ontology/features#isFeatureOf>.
};
SPARQL
SELECT ( COUNT ( * ) AS ?count )
FROM <urn:inference:product:feature:inverse>
WHERE { ?s ?p ?o } ;
RDFS_RULE_SET ( 'urn:inference:product:feature:inverse:rule','urn:inference:product:feature:inverse' );
-- Test Query 1
SPARQL
DEFINE input:inference 'urn:inference:product:feature:inverse:rule'
SELECT ( COUNT ( DISTINCT * ) AS ?count )
FROM <https://www.openlinksw.com/DAV/uda2.openlinksw.com/data/turtle/multi-tier/2019/UDAMTProductFeatures.ttl>
{
?s <http://www.openlinksw.com/ontology/features#hasFeature> ?o.
};
-- Test Query 1.2 Rules Disabled
SPARQL
# DEFINE input:inference 'urn:inference:product:feature:inverse:rule'
SELECT ( COUNT ( DISTINCT * ) AS ?count )
FROM <https://www.openlinksw.com/DAV/uda2.openlinksw.com/data/turtle/multi-tier/2019/UDAMTProductFeatures.ttl>
{
?s <http://www.openlinksw.com/ontology/features#hasFeature> ?o.
};
-- Test 2
SPARQL
DEFINE input:inference 'urn:inference:product:feature:inverse:rule'
SELECT *
FROM <https://www.openlinksw.com/DAV/uda2.openlinksw.com/data/turtle/multi-tier/2019/UDAMTProductFeatures.ttl>
{
?s <http://www.openlinksw.com/ontology/features#hasFeature> ?o.
};
-- Test 2.1
SPARQL
#DEFINE input:inference 'urn:inference:product:feature:inverse:rule'
SELECT *
FROM <https://www.openlinksw.com/DAV/uda2.openlinksw.com/data/turtle/multi-tier/2019/UDAMTProductFeatures.ttl>
{
?s <http://www.openlinksw.com/ontology/features#hasFeature> ?o.
};