s-emanuilov commited on
Commit
51b4d4e
·
verified ·
1 Parent(s): 0a63fe3

Upload 3 files

Browse files
knowledge_graph.ttl ADDED
The diff for this file is too large to render. See raw diff
 
worldmind_constraints.shacl.ttl ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @prefix : <http://worldmind.ai/rivers-v4#> .
2
+ @prefix sh: <http://www.w3.org/ns/shacl#> .
3
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
4
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
5
+
6
+ # SHACL Constraints for Rivers Extended Verification
7
+
8
+ # Constraint 1: Tributaries must be River instances
9
+ :TributaryTypeConstraint
10
+ a sh:NodeShape ;
11
+ sh:targetSubjectsOf :hasTributary ;
12
+ sh:sparql [
13
+ a sh:SPARQLConstraint ;
14
+ sh:message "Objects of :hasTributary must be instances of :River" ;
15
+ sh:select """
16
+ PREFIX : <http://worldmind.ai/rivers-v4#>
17
+
18
+ SELECT $this ?tributary
19
+ WHERE {
20
+ $this :hasTributary ?tributary .
21
+ FILTER NOT EXISTS {
22
+ ?tributary rdf:type :River .
23
+ }
24
+ }
25
+ """ ;
26
+ ] .
27
+
28
+ # Constraint 2: Source elevation must be positive
29
+ :SourceElevationPositiveConstraint
30
+ a sh:NodeShape ;
31
+ sh:targetClass :River ;
32
+ sh:sparql [
33
+ a sh:SPARQLConstraint ;
34
+ sh:message "Source elevation must be positive" ;
35
+ sh:select """
36
+ PREFIX : <http://worldmind.ai/rivers-v4#>
37
+
38
+ SELECT $this
39
+ WHERE {
40
+ $this :sourceElevation ?elev .
41
+ FILTER (?elev <= 0)
42
+ }
43
+ """ ;
44
+ ] .
45
+
46
+ # Constraint 3: Length must be positive
47
+ :LengthPositiveConstraint
48
+ a sh:NodeShape ;
49
+ sh:targetClass :River ;
50
+ sh:sparql [
51
+ a sh:SPARQLConstraint ;
52
+ sh:message "River length must be positive" ;
53
+ sh:select """
54
+ PREFIX : <http://worldmind.ai/rivers-v4#>
55
+
56
+ SELECT $this
57
+ WHERE {
58
+ $this :length ?len .
59
+ FILTER (?len <= 0)
60
+ }
61
+ """ ;
62
+ ] .
63
+
64
+ # Constraint 4: Discharge must be positive
65
+ :DischargePositiveConstraint
66
+ a sh:NodeShape ;
67
+ sh:targetClass :River ;
68
+ sh:sparql [
69
+ a sh:SPARQLConstraint ;
70
+ sh:message "Discharge must be positive" ;
71
+ sh:select """
72
+ PREFIX : <http://worldmind.ai/rivers-v4#>
73
+
74
+ SELECT $this
75
+ WHERE {
76
+ $this :discharge ?dis .
77
+ FILTER (?dis <= 0)
78
+ }
79
+ """ ;
80
+ ] .
81
+
82
+ # Constraint 5: Rivers with mouth elevation should have it >= 0 (sea level or above)
83
+ :MouthElevationConstraint
84
+ a sh:NodeShape ;
85
+ sh:targetClass :River ;
86
+ sh:sparql [
87
+ a sh:SPARQLConstraint ;
88
+ sh:message "Mouth elevation should typically be >= 0" ;
89
+ sh:select """
90
+ PREFIX : <http://worldmind.ai/rivers-v4#>
91
+
92
+ SELECT $this
93
+ WHERE {
94
+ $this :mouthElevation ?mouth .
95
+ FILTER (?mouth < -100)
96
+ }
97
+ """ ;
98
+ ] .
99
+
100
+ # Constraint 6: Source elevation must be > mouth elevation (rivers flow downhill)
101
+ :RiverFlowDownhillConstraint
102
+ a sh:NodeShape ;
103
+ sh:targetClass :River ;
104
+ sh:sparql [
105
+ a sh:SPARQLConstraint ;
106
+ sh:message "Source elevation must be greater than mouth elevation" ;
107
+ sh:select """
108
+ PREFIX : <http://worldmind.ai/rivers-v4#>
109
+
110
+ SELECT $this
111
+ WHERE {
112
+ $this :sourceElevation ?src .
113
+ $this :mouthElevation ?mouth .
114
+ FILTER (?src <= ?mouth)
115
+ }
116
+ """ ;
117
+ ] .
118
+
119
+ # Constraint 7: Geographic consistency - if river traverses a state, it should be in that state's country
120
+ :GeographicConsistencyConstraint
121
+ a sh:NodeShape ;
122
+ sh:targetSubjectsOf :traverses ;
123
+ sh:sparql [
124
+ a sh:SPARQLConstraint ;
125
+ sh:message "If traversing US state, river should be in US country" ;
126
+ sh:select """
127
+ PREFIX : <http://worldmind.ai/rivers-v4#>
128
+ PREFIX dbr: <http://dbpedia.org/resource/>
129
+
130
+ SELECT $this
131
+ WHERE {
132
+ $this :traverses ?state .
133
+ ?state rdf:type :State .
134
+ FILTER NOT EXISTS {
135
+ $this :inCountry dbr:United_States .
136
+ }
137
+ }
138
+ """ ;
139
+ ] .
worldmind_core.ttl ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @prefix : <http://worldmind.ai/rivers-v4#> .
2
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
3
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
4
+ @prefix owl: <http://www.w3.org/2002/07/owl#> .
5
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
6
+ @prefix dbr: <http://dbpedia.org/resource/> .
7
+
8
+ # Advanced Ontology for Rivers Extended Experiment
9
+ # Core Entities and Properties
10
+
11
+ # Classes
12
+ :River a owl:Class ;
13
+ rdfs:label "River" ;
14
+ rdfs:comment "A natural flowing watercourse" .
15
+
16
+ :GeographicFeature a owl:Class ;
17
+ rdfs:label "Geographic Feature" ;
18
+ rdfs:comment "A natural or administrative geographic entity" .
19
+
20
+ :State a owl:Class ;
21
+ rdfs:label "US State" ;
22
+ rdfs:comment "A US state" .
23
+
24
+ :County a owl:Class ;
25
+ rdfs:label "County" ;
26
+ rdfs:comment "A county subdivision" .
27
+
28
+ :Country a owl:Class ;
29
+ rdfs:label "Country" ;
30
+ rdfs:comment "A country or nation" .
31
+
32
+ :RiverSystem a owl:Class ;
33
+ rdfs:label "River System" ;
34
+ rdfs:comment "A major river system or watershed" .
35
+
36
+ :Elevation a owl:Class ;
37
+ rdfs:label "Elevation" ;
38
+ rdfs:comment "An elevation measurement in meters" .
39
+
40
+ # Object Properties
41
+ :hasSource a owl:ObjectProperty ;
42
+ rdfs:label "has source" ;
43
+ rdfs:comment "Relates a river to its source feature" ;
44
+ rdfs:domain :River ;
45
+ rdfs:range :GeographicFeature .
46
+
47
+ :hasMouth a owl:ObjectProperty ;
48
+ rdfs:label "has mouth" ;
49
+ rdfs:comment "Relates a river to its terminus" ;
50
+ rdfs:domain :River ;
51
+ rdfs:range :GeographicFeature .
52
+
53
+ :hasTributary a owl:ObjectProperty ;
54
+ rdfs:label "has tributary" ;
55
+ rdfs:comment "Relates a river to a tributary" ;
56
+ rdfs:domain :River ;
57
+ rdfs:range :River .
58
+
59
+ :flowsInto a owl:ObjectProperty ;
60
+ rdfs:label "flows into" ;
61
+ rdfs:comment "Relates a river to another river it flows into" ;
62
+ rdfs:domain :River ;
63
+ rdfs:range :River .
64
+
65
+ :traverses a owl:ObjectProperty ;
66
+ rdfs:label "traverses" ;
67
+ rdfs:comment "Relates a river to a US state it passes through" ;
68
+ rdfs:domain :River ;
69
+ rdfs:range :State .
70
+
71
+ :inCounty a owl:ObjectProperty ;
72
+ rdfs:label "in county" ;
73
+ rdfs:comment "Relates a river to a county" ;
74
+ rdfs:domain :River ;
75
+ rdfs:range :County .
76
+
77
+ :inCountry a owl:ObjectProperty ;
78
+ rdfs:label "in country" ;
79
+ rdfs:comment "Relates a river to a country" ;
80
+ rdfs:domain :River ;
81
+ rdfs:range :Country .
82
+
83
+ :partOfSystem a owl:ObjectProperty ;
84
+ rdfs:label "part of river system" ;
85
+ rdfs:comment "Relates a river to a river system" ;
86
+ rdfs:domain :River ;
87
+ rdfs:range :RiverSystem .
88
+
89
+ :drainsInto a owl:ObjectProperty ;
90
+ rdfs:label "drains into" ;
91
+ rdfs:comment "Relates a river to its drainage basin" ;
92
+ rdfs:domain :River ;
93
+ rdfs:range :GeographicFeature .
94
+
95
+ # Data Properties
96
+ :length a owl:DatatypeProperty ;
97
+ rdfs:label "length" ;
98
+ rdfs:comment "River length in meters" ;
99
+ rdfs:domain :River ;
100
+ rdfs:range xsd:double .
101
+
102
+ :discharge a owl:DatatypeProperty ;
103
+ rdfs:label "discharge" ;
104
+ rdfs:comment "Average discharge in cubic meters per second" ;
105
+ rdfs:domain :River ;
106
+ rdfs:range xsd:double .
107
+
108
+ :elevation a owl:DatatypeProperty ;
109
+ rdfs:label "elevation" ;
110
+ rdfs:comment "Elevation in meters" ;
111
+ rdfs:domain :GeographicFeature ;
112
+ rdfs:range xsd:double .
113
+
114
+ :sourceElevation a owl:DatatypeProperty ;
115
+ rdfs:label "source elevation" ;
116
+ rdfs:comment "Source elevation in meters" ;
117
+ rdfs:domain :River ;
118
+ rdfs:range xsd:double .
119
+
120
+ :mouthElevation a owl:DatatypeProperty ;
121
+ rdfs:label "mouth elevation" ;
122
+ rdfs:comment "Mouth elevation in meters" ;
123
+ rdfs:domain :River ;
124
+ rdfs:range xsd:double .
125
+
126
+ :abstractText a owl:DatatypeProperty ;
127
+ rdfs:label "abstract text" ;
128
+ rdfs:comment "Descriptive text about the river" ;
129
+ rdfs:domain :River ;
130
+ rdfs:range xsd:string .
131
+
132
+ :otherNames a owl:DatatypeProperty ;
133
+ rdfs:label "other names" ;
134
+ rdfs:comment "Alternative names for the river" ;
135
+ rdfs:domain :River ;
136
+ rdfs:range xsd:string .