eyeling 1.5.20 → 1.5.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/light-eaters.n3 +109 -0
- package/examples/odrl-trust.n3 +8 -7
- package/examples/output/light-eaters.n3 +326 -0
- package/examples/output/spectral-week.n3 +366 -0
- package/examples/spectral-week.n3 +104 -0
- package/package.json +1 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# ------------
|
|
2
|
+
# Light eaters
|
|
3
|
+
# ------------
|
|
4
|
+
|
|
5
|
+
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
|
|
6
|
+
@prefix : <http://example.org/light-eaters#>.
|
|
7
|
+
|
|
8
|
+
# ------------------------------------------------------------
|
|
9
|
+
# Plants as "light eaters":
|
|
10
|
+
# convert daily light exposure into stored energy (photosynthesis),
|
|
11
|
+
# then decide whether they thrive or go hungry under their conditions.
|
|
12
|
+
# ------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
# One day with a fixed amount of usable light (hours)
|
|
15
|
+
:Today :lightHours 10.0.
|
|
16
|
+
|
|
17
|
+
# Two habitats with different light intensities (arbitrary units/hour)
|
|
18
|
+
:Meadow :lightIntensity 100.0.
|
|
19
|
+
:Forest :lightIntensity 20.0.
|
|
20
|
+
|
|
21
|
+
# Organisms
|
|
22
|
+
:Sunflower a :Plant; :location :Meadow; :chlorophyll true; :efficiency 0.25; :maintenance 150.0.
|
|
23
|
+
:Fern a :Plant; :location :Forest; :chlorophyll true; :efficiency 0.25; :maintenance 150.0.
|
|
24
|
+
:Mushroom a :Fungus; :location :Forest; :chlorophyll false; :maintenance 150.0.
|
|
25
|
+
|
|
26
|
+
# ------------------------------------------------------------
|
|
27
|
+
# Rules
|
|
28
|
+
# ------------------------------------------------------------
|
|
29
|
+
|
|
30
|
+
# (1) Daily light energy available at each place:
|
|
31
|
+
# E_place = lightIntensity * lightHours
|
|
32
|
+
{
|
|
33
|
+
:Today :lightHours ?H.
|
|
34
|
+
?Place :lightIntensity ?I.
|
|
35
|
+
(?I ?H) math:product ?E.
|
|
36
|
+
}
|
|
37
|
+
=>
|
|
38
|
+
{
|
|
39
|
+
?Place :dailyLightEnergy ?E.
|
|
40
|
+
}.
|
|
41
|
+
|
|
42
|
+
# (2) Stored energy for each plant:
|
|
43
|
+
# stored = E_place * efficiency
|
|
44
|
+
{
|
|
45
|
+
?Plant a :Plant.
|
|
46
|
+
?Plant :location ?Place.
|
|
47
|
+
?Place :dailyLightEnergy ?E.
|
|
48
|
+
?Plant :efficiency ?Eff.
|
|
49
|
+
(?E ?Eff) math:product ?Stored.
|
|
50
|
+
}
|
|
51
|
+
=>
|
|
52
|
+
{
|
|
53
|
+
?Plant :storedEnergy ?Stored.
|
|
54
|
+
}.
|
|
55
|
+
|
|
56
|
+
# (3) Net energy after maintenance:
|
|
57
|
+
# net = stored - maintenance
|
|
58
|
+
{
|
|
59
|
+
?Org :storedEnergy ?Stored.
|
|
60
|
+
?Org :maintenance ?Maint.
|
|
61
|
+
(?Stored ?Maint) math:difference ?Net.
|
|
62
|
+
}
|
|
63
|
+
=>
|
|
64
|
+
{
|
|
65
|
+
?Org :netEnergy ?Net.
|
|
66
|
+
}.
|
|
67
|
+
|
|
68
|
+
# (4) "Light eater" (photosynthesizer) classification:
|
|
69
|
+
# must be a Plant, must have chlorophyll, and must have positive stored energy
|
|
70
|
+
{
|
|
71
|
+
?Plant a :Plant.
|
|
72
|
+
?Plant :chlorophyll true.
|
|
73
|
+
?Plant :storedEnergy ?Stored.
|
|
74
|
+
(?Stored 0.0) math:greaterThan true.
|
|
75
|
+
}
|
|
76
|
+
=>
|
|
77
|
+
{
|
|
78
|
+
?Plant :canPhotosynthesize true.
|
|
79
|
+
?Plant :lightEater true.
|
|
80
|
+
}.
|
|
81
|
+
|
|
82
|
+
# Non-photosynthesizers (example: fungi)
|
|
83
|
+
{
|
|
84
|
+
?X a :Fungus.
|
|
85
|
+
}
|
|
86
|
+
=>
|
|
87
|
+
{
|
|
88
|
+
?X :lightEater false.
|
|
89
|
+
}.
|
|
90
|
+
|
|
91
|
+
# (5) Outcome: thriving vs hungry, based on netEnergy
|
|
92
|
+
{
|
|
93
|
+
?Org :netEnergy ?Net.
|
|
94
|
+
(?Net 0.0) math:greaterThan true.
|
|
95
|
+
}
|
|
96
|
+
=>
|
|
97
|
+
{
|
|
98
|
+
?Org :thriving true.
|
|
99
|
+
}.
|
|
100
|
+
|
|
101
|
+
{
|
|
102
|
+
?Org :netEnergy ?Net.
|
|
103
|
+
(?Net 0.0) math:notGreaterThan true.
|
|
104
|
+
}
|
|
105
|
+
=>
|
|
106
|
+
{
|
|
107
|
+
?Org :hungry true.
|
|
108
|
+
}.
|
|
109
|
+
|
package/examples/odrl-trust.n3
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
# ODRL trust
|
|
3
3
|
# ----------
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
|
|
7
6
|
@prefix odrl: <http://www.w3.org/ns/odrl/2/>.
|
|
8
7
|
@prefix dct: <http://purl.org/dc/terms/>.
|
|
@@ -11,21 +10,23 @@
|
|
|
11
10
|
# ------------------
|
|
12
11
|
# Trust model (0..1)
|
|
13
12
|
# ------------------
|
|
13
|
+
|
|
14
14
|
:Gov :trust 0.95.
|
|
15
15
|
:Partner :trust 0.70.
|
|
16
16
|
:RandomBlog :trust 0.30.
|
|
17
17
|
|
|
18
|
-
#
|
|
18
|
+
# ---------------------------
|
|
19
19
|
# A request we want to decide
|
|
20
|
-
#
|
|
20
|
+
# ---------------------------
|
|
21
|
+
|
|
21
22
|
:req1 a :Request;
|
|
22
23
|
odrl:assignee :Alice;
|
|
23
24
|
odrl:target :Doc1;
|
|
24
25
|
odrl:action odrl:read.
|
|
25
26
|
|
|
26
|
-
#
|
|
27
|
+
# -------------
|
|
27
28
|
# ODRL Policies
|
|
28
|
-
#
|
|
29
|
+
# -------------
|
|
29
30
|
|
|
30
31
|
# High-trust permission from Gov (trusted enough)
|
|
31
32
|
:PolGov a odrl:Policy;
|
|
@@ -75,9 +76,9 @@
|
|
|
75
76
|
odrl:operator odrl:gteq;
|
|
76
77
|
odrl:rightOperand 0.50.
|
|
77
78
|
|
|
78
|
-
#
|
|
79
|
+
# --------------------------------
|
|
79
80
|
# Minimal "ODRL + trust" evaluator
|
|
80
|
-
#
|
|
81
|
+
# --------------------------------
|
|
81
82
|
|
|
82
83
|
# Candidate PERMIT for a request, scored by issuer trust, only if trust >= minTrust
|
|
83
84
|
{
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
@prefix : <http://example.org/light-eaters#> .
|
|
2
|
+
|
|
3
|
+
# ----------------------------------------------------------------------
|
|
4
|
+
# Proof for derived triple:
|
|
5
|
+
# :Forest :dailyLightEnergy 200 .
|
|
6
|
+
# It holds because the following instance of the rule body is provable:
|
|
7
|
+
# :Today :lightHours 10.0 .
|
|
8
|
+
# :Forest :lightIntensity 20.0 .
|
|
9
|
+
# (20.0 10.0) math:product 200 .
|
|
10
|
+
# via the schematic forward rule:
|
|
11
|
+
# {
|
|
12
|
+
# :Today :lightHours ?H .
|
|
13
|
+
# ?Place :lightIntensity ?I .
|
|
14
|
+
# (?I ?H) math:product ?E .
|
|
15
|
+
# } => {
|
|
16
|
+
# ?Place :dailyLightEnergy ?E .
|
|
17
|
+
# } .
|
|
18
|
+
# with substitution (on rule variables):
|
|
19
|
+
# ?E = 200
|
|
20
|
+
# ?H = 10.0
|
|
21
|
+
# ?I = 20.0
|
|
22
|
+
# ?Place = :Forest
|
|
23
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
24
|
+
# ----------------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
:Forest :dailyLightEnergy 200 .
|
|
27
|
+
|
|
28
|
+
# ----------------------------------------------------------------------
|
|
29
|
+
# Proof for derived triple:
|
|
30
|
+
# :Meadow :dailyLightEnergy 1000 .
|
|
31
|
+
# It holds because the following instance of the rule body is provable:
|
|
32
|
+
# :Today :lightHours 10.0 .
|
|
33
|
+
# :Meadow :lightIntensity 100.0 .
|
|
34
|
+
# (100.0 10.0) math:product 1000 .
|
|
35
|
+
# via the schematic forward rule:
|
|
36
|
+
# {
|
|
37
|
+
# :Today :lightHours ?H .
|
|
38
|
+
# ?Place :lightIntensity ?I .
|
|
39
|
+
# (?I ?H) math:product ?E .
|
|
40
|
+
# } => {
|
|
41
|
+
# ?Place :dailyLightEnergy ?E .
|
|
42
|
+
# } .
|
|
43
|
+
# with substitution (on rule variables):
|
|
44
|
+
# ?E = 1000
|
|
45
|
+
# ?H = 10.0
|
|
46
|
+
# ?I = 100.0
|
|
47
|
+
# ?Place = :Meadow
|
|
48
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
49
|
+
# ----------------------------------------------------------------------
|
|
50
|
+
|
|
51
|
+
:Meadow :dailyLightEnergy 1000 .
|
|
52
|
+
|
|
53
|
+
# ----------------------------------------------------------------------
|
|
54
|
+
# Proof for derived triple:
|
|
55
|
+
# :Fern :storedEnergy 50 .
|
|
56
|
+
# It holds because the following instance of the rule body is provable:
|
|
57
|
+
# :Fern a :Plant .
|
|
58
|
+
# :Fern :location :Forest .
|
|
59
|
+
# :Forest :dailyLightEnergy 200 .
|
|
60
|
+
# :Fern :efficiency 0.25 .
|
|
61
|
+
# (200 0.25) math:product 50 .
|
|
62
|
+
# via the schematic forward rule:
|
|
63
|
+
# {
|
|
64
|
+
# ?Plant a :Plant .
|
|
65
|
+
# ?Plant :location ?Place .
|
|
66
|
+
# ?Place :dailyLightEnergy ?E .
|
|
67
|
+
# ?Plant :efficiency ?Eff .
|
|
68
|
+
# (?E ?Eff) math:product ?Stored .
|
|
69
|
+
# } => {
|
|
70
|
+
# ?Plant :storedEnergy ?Stored .
|
|
71
|
+
# } .
|
|
72
|
+
# with substitution (on rule variables):
|
|
73
|
+
# ?E = 200
|
|
74
|
+
# ?Eff = 0.25
|
|
75
|
+
# ?Place = :Forest
|
|
76
|
+
# ?Plant = :Fern
|
|
77
|
+
# ?Stored = 50
|
|
78
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
79
|
+
# ----------------------------------------------------------------------
|
|
80
|
+
|
|
81
|
+
:Fern :storedEnergy 50 .
|
|
82
|
+
|
|
83
|
+
# ----------------------------------------------------------------------
|
|
84
|
+
# Proof for derived triple:
|
|
85
|
+
# :Sunflower :storedEnergy 250 .
|
|
86
|
+
# It holds because the following instance of the rule body is provable:
|
|
87
|
+
# :Sunflower a :Plant .
|
|
88
|
+
# :Sunflower :location :Meadow .
|
|
89
|
+
# :Meadow :dailyLightEnergy 1000 .
|
|
90
|
+
# :Sunflower :efficiency 0.25 .
|
|
91
|
+
# (1000 0.25) math:product 250 .
|
|
92
|
+
# via the schematic forward rule:
|
|
93
|
+
# {
|
|
94
|
+
# ?Plant a :Plant .
|
|
95
|
+
# ?Plant :location ?Place .
|
|
96
|
+
# ?Place :dailyLightEnergy ?E .
|
|
97
|
+
# ?Plant :efficiency ?Eff .
|
|
98
|
+
# (?E ?Eff) math:product ?Stored .
|
|
99
|
+
# } => {
|
|
100
|
+
# ?Plant :storedEnergy ?Stored .
|
|
101
|
+
# } .
|
|
102
|
+
# with substitution (on rule variables):
|
|
103
|
+
# ?E = 1000
|
|
104
|
+
# ?Eff = 0.25
|
|
105
|
+
# ?Place = :Meadow
|
|
106
|
+
# ?Plant = :Sunflower
|
|
107
|
+
# ?Stored = 250
|
|
108
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
109
|
+
# ----------------------------------------------------------------------
|
|
110
|
+
|
|
111
|
+
:Sunflower :storedEnergy 250 .
|
|
112
|
+
|
|
113
|
+
# ----------------------------------------------------------------------
|
|
114
|
+
# Proof for derived triple:
|
|
115
|
+
# :Sunflower :netEnergy 100 .
|
|
116
|
+
# It holds because the following instance of the rule body is provable:
|
|
117
|
+
# :Sunflower :storedEnergy 250 .
|
|
118
|
+
# :Sunflower :maintenance 150.0 .
|
|
119
|
+
# (250 150.0) math:difference 100 .
|
|
120
|
+
# via the schematic forward rule:
|
|
121
|
+
# {
|
|
122
|
+
# ?Org :storedEnergy ?Stored .
|
|
123
|
+
# ?Org :maintenance ?Maint .
|
|
124
|
+
# (?Stored ?Maint) math:difference ?Net .
|
|
125
|
+
# } => {
|
|
126
|
+
# ?Org :netEnergy ?Net .
|
|
127
|
+
# } .
|
|
128
|
+
# with substitution (on rule variables):
|
|
129
|
+
# ?Maint = 150.0
|
|
130
|
+
# ?Net = 100
|
|
131
|
+
# ?Org = :Sunflower
|
|
132
|
+
# ?Stored = 250
|
|
133
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
134
|
+
# ----------------------------------------------------------------------
|
|
135
|
+
|
|
136
|
+
:Sunflower :netEnergy 100 .
|
|
137
|
+
|
|
138
|
+
# ----------------------------------------------------------------------
|
|
139
|
+
# Proof for derived triple:
|
|
140
|
+
# :Fern :netEnergy -100 .
|
|
141
|
+
# It holds because the following instance of the rule body is provable:
|
|
142
|
+
# :Fern :storedEnergy 50 .
|
|
143
|
+
# :Fern :maintenance 150.0 .
|
|
144
|
+
# (50 150.0) math:difference -100 .
|
|
145
|
+
# via the schematic forward rule:
|
|
146
|
+
# {
|
|
147
|
+
# ?Org :storedEnergy ?Stored .
|
|
148
|
+
# ?Org :maintenance ?Maint .
|
|
149
|
+
# (?Stored ?Maint) math:difference ?Net .
|
|
150
|
+
# } => {
|
|
151
|
+
# ?Org :netEnergy ?Net .
|
|
152
|
+
# } .
|
|
153
|
+
# with substitution (on rule variables):
|
|
154
|
+
# ?Maint = 150.0
|
|
155
|
+
# ?Net = -100
|
|
156
|
+
# ?Org = :Fern
|
|
157
|
+
# ?Stored = 50
|
|
158
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
159
|
+
# ----------------------------------------------------------------------
|
|
160
|
+
|
|
161
|
+
:Fern :netEnergy -100 .
|
|
162
|
+
|
|
163
|
+
# ----------------------------------------------------------------------
|
|
164
|
+
# Proof for derived triple:
|
|
165
|
+
# :Fern :canPhotosynthesize true .
|
|
166
|
+
# It holds because the following instance of the rule body is provable:
|
|
167
|
+
# :Fern a :Plant .
|
|
168
|
+
# :Fern :chlorophyll true .
|
|
169
|
+
# :Fern :storedEnergy 50 .
|
|
170
|
+
# (50 0.0) math:greaterThan true .
|
|
171
|
+
# via the schematic forward rule:
|
|
172
|
+
# {
|
|
173
|
+
# ?Plant a :Plant .
|
|
174
|
+
# ?Plant :chlorophyll true .
|
|
175
|
+
# ?Plant :storedEnergy ?Stored .
|
|
176
|
+
# (?Stored 0.0) math:greaterThan true .
|
|
177
|
+
# } => {
|
|
178
|
+
# ?Plant :canPhotosynthesize true .
|
|
179
|
+
# ?Plant :lightEater true .
|
|
180
|
+
# } .
|
|
181
|
+
# with substitution (on rule variables):
|
|
182
|
+
# ?Plant = :Fern
|
|
183
|
+
# ?Stored = 50
|
|
184
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
185
|
+
# ----------------------------------------------------------------------
|
|
186
|
+
|
|
187
|
+
:Fern :canPhotosynthesize true .
|
|
188
|
+
|
|
189
|
+
# ----------------------------------------------------------------------
|
|
190
|
+
# Proof for derived triple:
|
|
191
|
+
# :Fern :lightEater true .
|
|
192
|
+
# It holds because the following instance of the rule body is provable:
|
|
193
|
+
# :Fern a :Plant .
|
|
194
|
+
# :Fern :chlorophyll true .
|
|
195
|
+
# :Fern :storedEnergy 50 .
|
|
196
|
+
# (50 0.0) math:greaterThan true .
|
|
197
|
+
# via the schematic forward rule:
|
|
198
|
+
# {
|
|
199
|
+
# ?Plant a :Plant .
|
|
200
|
+
# ?Plant :chlorophyll true .
|
|
201
|
+
# ?Plant :storedEnergy ?Stored .
|
|
202
|
+
# (?Stored 0.0) math:greaterThan true .
|
|
203
|
+
# } => {
|
|
204
|
+
# ?Plant :canPhotosynthesize true .
|
|
205
|
+
# ?Plant :lightEater true .
|
|
206
|
+
# } .
|
|
207
|
+
# with substitution (on rule variables):
|
|
208
|
+
# ?Plant = :Fern
|
|
209
|
+
# ?Stored = 50
|
|
210
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
211
|
+
# ----------------------------------------------------------------------
|
|
212
|
+
|
|
213
|
+
:Fern :lightEater true .
|
|
214
|
+
|
|
215
|
+
# ----------------------------------------------------------------------
|
|
216
|
+
# Proof for derived triple:
|
|
217
|
+
# :Sunflower :canPhotosynthesize true .
|
|
218
|
+
# It holds because the following instance of the rule body is provable:
|
|
219
|
+
# :Sunflower a :Plant .
|
|
220
|
+
# :Sunflower :chlorophyll true .
|
|
221
|
+
# :Sunflower :storedEnergy 250 .
|
|
222
|
+
# (250 0.0) math:greaterThan true .
|
|
223
|
+
# via the schematic forward rule:
|
|
224
|
+
# {
|
|
225
|
+
# ?Plant a :Plant .
|
|
226
|
+
# ?Plant :chlorophyll true .
|
|
227
|
+
# ?Plant :storedEnergy ?Stored .
|
|
228
|
+
# (?Stored 0.0) math:greaterThan true .
|
|
229
|
+
# } => {
|
|
230
|
+
# ?Plant :canPhotosynthesize true .
|
|
231
|
+
# ?Plant :lightEater true .
|
|
232
|
+
# } .
|
|
233
|
+
# with substitution (on rule variables):
|
|
234
|
+
# ?Plant = :Sunflower
|
|
235
|
+
# ?Stored = 250
|
|
236
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
237
|
+
# ----------------------------------------------------------------------
|
|
238
|
+
|
|
239
|
+
:Sunflower :canPhotosynthesize true .
|
|
240
|
+
|
|
241
|
+
# ----------------------------------------------------------------------
|
|
242
|
+
# Proof for derived triple:
|
|
243
|
+
# :Sunflower :lightEater true .
|
|
244
|
+
# It holds because the following instance of the rule body is provable:
|
|
245
|
+
# :Sunflower a :Plant .
|
|
246
|
+
# :Sunflower :chlorophyll true .
|
|
247
|
+
# :Sunflower :storedEnergy 250 .
|
|
248
|
+
# (250 0.0) math:greaterThan true .
|
|
249
|
+
# via the schematic forward rule:
|
|
250
|
+
# {
|
|
251
|
+
# ?Plant a :Plant .
|
|
252
|
+
# ?Plant :chlorophyll true .
|
|
253
|
+
# ?Plant :storedEnergy ?Stored .
|
|
254
|
+
# (?Stored 0.0) math:greaterThan true .
|
|
255
|
+
# } => {
|
|
256
|
+
# ?Plant :canPhotosynthesize true .
|
|
257
|
+
# ?Plant :lightEater true .
|
|
258
|
+
# } .
|
|
259
|
+
# with substitution (on rule variables):
|
|
260
|
+
# ?Plant = :Sunflower
|
|
261
|
+
# ?Stored = 250
|
|
262
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
263
|
+
# ----------------------------------------------------------------------
|
|
264
|
+
|
|
265
|
+
:Sunflower :lightEater true .
|
|
266
|
+
|
|
267
|
+
# ----------------------------------------------------------------------
|
|
268
|
+
# Proof for derived triple:
|
|
269
|
+
# :Mushroom :lightEater false .
|
|
270
|
+
# It holds because the following instance of the rule body is provable:
|
|
271
|
+
# :Mushroom a :Fungus .
|
|
272
|
+
# via the schematic forward rule:
|
|
273
|
+
# {
|
|
274
|
+
# ?X a :Fungus .
|
|
275
|
+
# } => {
|
|
276
|
+
# ?X :lightEater false .
|
|
277
|
+
# } .
|
|
278
|
+
# with substitution (on rule variables):
|
|
279
|
+
# ?X = :Mushroom
|
|
280
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
281
|
+
# ----------------------------------------------------------------------
|
|
282
|
+
|
|
283
|
+
:Mushroom :lightEater false .
|
|
284
|
+
|
|
285
|
+
# ----------------------------------------------------------------------
|
|
286
|
+
# Proof for derived triple:
|
|
287
|
+
# :Sunflower :thriving true .
|
|
288
|
+
# It holds because the following instance of the rule body is provable:
|
|
289
|
+
# :Sunflower :netEnergy 100 .
|
|
290
|
+
# (100 0.0) math:greaterThan true .
|
|
291
|
+
# via the schematic forward rule:
|
|
292
|
+
# {
|
|
293
|
+
# ?Org :netEnergy ?Net .
|
|
294
|
+
# (?Net 0.0) math:greaterThan true .
|
|
295
|
+
# } => {
|
|
296
|
+
# ?Org :thriving true .
|
|
297
|
+
# } .
|
|
298
|
+
# with substitution (on rule variables):
|
|
299
|
+
# ?Net = 100
|
|
300
|
+
# ?Org = :Sunflower
|
|
301
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
302
|
+
# ----------------------------------------------------------------------
|
|
303
|
+
|
|
304
|
+
:Sunflower :thriving true .
|
|
305
|
+
|
|
306
|
+
# ----------------------------------------------------------------------
|
|
307
|
+
# Proof for derived triple:
|
|
308
|
+
# :Fern :hungry true .
|
|
309
|
+
# It holds because the following instance of the rule body is provable:
|
|
310
|
+
# :Fern :netEnergy -100 .
|
|
311
|
+
# (-100 0.0) math:notGreaterThan true .
|
|
312
|
+
# via the schematic forward rule:
|
|
313
|
+
# {
|
|
314
|
+
# ?Org :netEnergy ?Net .
|
|
315
|
+
# (?Net 0.0) math:notGreaterThan true .
|
|
316
|
+
# } => {
|
|
317
|
+
# ?Org :hungry true .
|
|
318
|
+
# } .
|
|
319
|
+
# with substitution (on rule variables):
|
|
320
|
+
# ?Net = -100
|
|
321
|
+
# ?Org = :Fern
|
|
322
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
323
|
+
# ----------------------------------------------------------------------
|
|
324
|
+
|
|
325
|
+
:Fern :hungry true .
|
|
326
|
+
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
@prefix : <http://example.org/spectral-week#> .
|
|
2
|
+
|
|
3
|
+
# ----------------------------------------------------------------------
|
|
4
|
+
# Proof for derived triple:
|
|
5
|
+
# :Shade :redEnergy 180 .
|
|
6
|
+
# It holds because the following instance of the rule body is provable:
|
|
7
|
+
# :Shade :redIntensity 60.0 .
|
|
8
|
+
# :Shade :redHours 3.0 .
|
|
9
|
+
# (60.0 3.0) math:product 180 .
|
|
10
|
+
# via the schematic forward rule:
|
|
11
|
+
# {
|
|
12
|
+
# ?Loc :redIntensity ?RI .
|
|
13
|
+
# ?Loc :redHours ?RH .
|
|
14
|
+
# (?RI ?RH) math:product ?Ered .
|
|
15
|
+
# } => {
|
|
16
|
+
# ?Loc :redEnergy ?Ered .
|
|
17
|
+
# } .
|
|
18
|
+
# with substitution (on rule variables):
|
|
19
|
+
# ?Ered = 180
|
|
20
|
+
# ?Loc = :Shade
|
|
21
|
+
# ?RH = 3.0
|
|
22
|
+
# ?RI = 60.0
|
|
23
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
24
|
+
# ----------------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
:Shade :redEnergy 180 .
|
|
27
|
+
|
|
28
|
+
# ----------------------------------------------------------------------
|
|
29
|
+
# Proof for derived triple:
|
|
30
|
+
# :Greenhouse :redEnergy 960 .
|
|
31
|
+
# It holds because the following instance of the rule body is provable:
|
|
32
|
+
# :Greenhouse :redIntensity 120.0 .
|
|
33
|
+
# :Greenhouse :redHours 8.0 .
|
|
34
|
+
# (120.0 8.0) math:product 960 .
|
|
35
|
+
# via the schematic forward rule:
|
|
36
|
+
# {
|
|
37
|
+
# ?Loc :redIntensity ?RI .
|
|
38
|
+
# ?Loc :redHours ?RH .
|
|
39
|
+
# (?RI ?RH) math:product ?Ered .
|
|
40
|
+
# } => {
|
|
41
|
+
# ?Loc :redEnergy ?Ered .
|
|
42
|
+
# } .
|
|
43
|
+
# with substitution (on rule variables):
|
|
44
|
+
# ?Ered = 960
|
|
45
|
+
# ?Loc = :Greenhouse
|
|
46
|
+
# ?RH = 8.0
|
|
47
|
+
# ?RI = 120.0
|
|
48
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
49
|
+
# ----------------------------------------------------------------------
|
|
50
|
+
|
|
51
|
+
:Greenhouse :redEnergy 960 .
|
|
52
|
+
|
|
53
|
+
# ----------------------------------------------------------------------
|
|
54
|
+
# Proof for derived triple:
|
|
55
|
+
# :Shade :blueEnergy 80 .
|
|
56
|
+
# It holds because the following instance of the rule body is provable:
|
|
57
|
+
# :Shade :blueIntensity 80.0 .
|
|
58
|
+
# :Shade :blueHours 1.0 .
|
|
59
|
+
# (80.0 1.0) math:product 80 .
|
|
60
|
+
# via the schematic forward rule:
|
|
61
|
+
# {
|
|
62
|
+
# ?Loc :blueIntensity ?BI .
|
|
63
|
+
# ?Loc :blueHours ?BH .
|
|
64
|
+
# (?BI ?BH) math:product ?Eblue .
|
|
65
|
+
# } => {
|
|
66
|
+
# ?Loc :blueEnergy ?Eblue .
|
|
67
|
+
# } .
|
|
68
|
+
# with substitution (on rule variables):
|
|
69
|
+
# ?BH = 1.0
|
|
70
|
+
# ?BI = 80.0
|
|
71
|
+
# ?Eblue = 80
|
|
72
|
+
# ?Loc = :Shade
|
|
73
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
74
|
+
# ----------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
:Shade :blueEnergy 80 .
|
|
77
|
+
|
|
78
|
+
# ----------------------------------------------------------------------
|
|
79
|
+
# Proof for derived triple:
|
|
80
|
+
# :Greenhouse :blueEnergy 400 .
|
|
81
|
+
# It holds because the following instance of the rule body is provable:
|
|
82
|
+
# :Greenhouse :blueIntensity 200.0 .
|
|
83
|
+
# :Greenhouse :blueHours 2.0 .
|
|
84
|
+
# (200.0 2.0) math:product 400 .
|
|
85
|
+
# via the schematic forward rule:
|
|
86
|
+
# {
|
|
87
|
+
# ?Loc :blueIntensity ?BI .
|
|
88
|
+
# ?Loc :blueHours ?BH .
|
|
89
|
+
# (?BI ?BH) math:product ?Eblue .
|
|
90
|
+
# } => {
|
|
91
|
+
# ?Loc :blueEnergy ?Eblue .
|
|
92
|
+
# } .
|
|
93
|
+
# with substitution (on rule variables):
|
|
94
|
+
# ?BH = 2.0
|
|
95
|
+
# ?BI = 200.0
|
|
96
|
+
# ?Eblue = 400
|
|
97
|
+
# ?Loc = :Greenhouse
|
|
98
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
99
|
+
# ----------------------------------------------------------------------
|
|
100
|
+
|
|
101
|
+
:Greenhouse :blueEnergy 400 .
|
|
102
|
+
|
|
103
|
+
# ----------------------------------------------------------------------
|
|
104
|
+
# Proof for derived triple:
|
|
105
|
+
# :Fern :absorbedRed 72 .
|
|
106
|
+
# It holds because the following instance of the rule body is provable:
|
|
107
|
+
# :Fern a :Plant .
|
|
108
|
+
# :Fern :location :Shade .
|
|
109
|
+
# :Fern :absorbRed 0.40 .
|
|
110
|
+
# :Shade :redEnergy 180 .
|
|
111
|
+
# (180 0.40) math:product 72 .
|
|
112
|
+
# via the schematic forward rule:
|
|
113
|
+
# {
|
|
114
|
+
# ?P a :Plant .
|
|
115
|
+
# ?P :location ?Loc .
|
|
116
|
+
# ?P :absorbRed ?AR .
|
|
117
|
+
# ?Loc :redEnergy ?Ered .
|
|
118
|
+
# (?Ered ?AR) math:product ?Ared .
|
|
119
|
+
# } => {
|
|
120
|
+
# ?P :absorbedRed ?Ared .
|
|
121
|
+
# } .
|
|
122
|
+
# with substitution (on rule variables):
|
|
123
|
+
# ?AR = 0.40
|
|
124
|
+
# ?Ared = 72
|
|
125
|
+
# ?Ered = 180
|
|
126
|
+
# ?Loc = :Shade
|
|
127
|
+
# ?P = :Fern
|
|
128
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
129
|
+
# ----------------------------------------------------------------------
|
|
130
|
+
|
|
131
|
+
:Fern :absorbedRed 72 .
|
|
132
|
+
|
|
133
|
+
# ----------------------------------------------------------------------
|
|
134
|
+
# Proof for derived triple:
|
|
135
|
+
# :Sunflower :absorbedRed 816 .
|
|
136
|
+
# It holds because the following instance of the rule body is provable:
|
|
137
|
+
# :Sunflower a :Plant .
|
|
138
|
+
# :Sunflower :location :Greenhouse .
|
|
139
|
+
# :Sunflower :absorbRed 0.85 .
|
|
140
|
+
# :Greenhouse :redEnergy 960 .
|
|
141
|
+
# (960 0.85) math:product 816 .
|
|
142
|
+
# via the schematic forward rule:
|
|
143
|
+
# {
|
|
144
|
+
# ?P a :Plant .
|
|
145
|
+
# ?P :location ?Loc .
|
|
146
|
+
# ?P :absorbRed ?AR .
|
|
147
|
+
# ?Loc :redEnergy ?Ered .
|
|
148
|
+
# (?Ered ?AR) math:product ?Ared .
|
|
149
|
+
# } => {
|
|
150
|
+
# ?P :absorbedRed ?Ared .
|
|
151
|
+
# } .
|
|
152
|
+
# with substitution (on rule variables):
|
|
153
|
+
# ?AR = 0.85
|
|
154
|
+
# ?Ared = 816
|
|
155
|
+
# ?Ered = 960
|
|
156
|
+
# ?Loc = :Greenhouse
|
|
157
|
+
# ?P = :Sunflower
|
|
158
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
159
|
+
# ----------------------------------------------------------------------
|
|
160
|
+
|
|
161
|
+
:Sunflower :absorbedRed 816 .
|
|
162
|
+
|
|
163
|
+
# ----------------------------------------------------------------------
|
|
164
|
+
# Proof for derived triple:
|
|
165
|
+
# :Fern :absorbedBlue 60 .
|
|
166
|
+
# It holds because the following instance of the rule body is provable:
|
|
167
|
+
# :Fern a :Plant .
|
|
168
|
+
# :Fern :location :Shade .
|
|
169
|
+
# :Fern :absorbBlue 0.75 .
|
|
170
|
+
# :Shade :blueEnergy 80 .
|
|
171
|
+
# (80 0.75) math:product 60 .
|
|
172
|
+
# via the schematic forward rule:
|
|
173
|
+
# {
|
|
174
|
+
# ?P a :Plant .
|
|
175
|
+
# ?P :location ?Loc .
|
|
176
|
+
# ?P :absorbBlue ?AB .
|
|
177
|
+
# ?Loc :blueEnergy ?Eblue .
|
|
178
|
+
# (?Eblue ?AB) math:product ?Ablue .
|
|
179
|
+
# } => {
|
|
180
|
+
# ?P :absorbedBlue ?Ablue .
|
|
181
|
+
# } .
|
|
182
|
+
# with substitution (on rule variables):
|
|
183
|
+
# ?AB = 0.75
|
|
184
|
+
# ?Ablue = 60
|
|
185
|
+
# ?Eblue = 80
|
|
186
|
+
# ?Loc = :Shade
|
|
187
|
+
# ?P = :Fern
|
|
188
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
189
|
+
# ----------------------------------------------------------------------
|
|
190
|
+
|
|
191
|
+
:Fern :absorbedBlue 60 .
|
|
192
|
+
|
|
193
|
+
# ----------------------------------------------------------------------
|
|
194
|
+
# Proof for derived triple:
|
|
195
|
+
# :Sunflower :absorbedBlue 220.00000000000003 .
|
|
196
|
+
# It holds because the following instance of the rule body is provable:
|
|
197
|
+
# :Sunflower a :Plant .
|
|
198
|
+
# :Sunflower :location :Greenhouse .
|
|
199
|
+
# :Sunflower :absorbBlue 0.55 .
|
|
200
|
+
# :Greenhouse :blueEnergy 400 .
|
|
201
|
+
# (400 0.55) math:product 220.00000000000003 .
|
|
202
|
+
# via the schematic forward rule:
|
|
203
|
+
# {
|
|
204
|
+
# ?P a :Plant .
|
|
205
|
+
# ?P :location ?Loc .
|
|
206
|
+
# ?P :absorbBlue ?AB .
|
|
207
|
+
# ?Loc :blueEnergy ?Eblue .
|
|
208
|
+
# (?Eblue ?AB) math:product ?Ablue .
|
|
209
|
+
# } => {
|
|
210
|
+
# ?P :absorbedBlue ?Ablue .
|
|
211
|
+
# } .
|
|
212
|
+
# with substitution (on rule variables):
|
|
213
|
+
# ?AB = 0.55
|
|
214
|
+
# ?Ablue = 220.00000000000003
|
|
215
|
+
# ?Eblue = 400
|
|
216
|
+
# ?Loc = :Greenhouse
|
|
217
|
+
# ?P = :Sunflower
|
|
218
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
219
|
+
# ----------------------------------------------------------------------
|
|
220
|
+
|
|
221
|
+
:Sunflower :absorbedBlue 220.00000000000003 .
|
|
222
|
+
|
|
223
|
+
# ----------------------------------------------------------------------
|
|
224
|
+
# Proof for derived triple:
|
|
225
|
+
# :Sunflower :absorbedEnergy 1036 .
|
|
226
|
+
# It holds because the following instance of the rule body is provable:
|
|
227
|
+
# :Sunflower :absorbedRed 816 .
|
|
228
|
+
# :Sunflower :absorbedBlue 220.00000000000003 .
|
|
229
|
+
# (816 220.00000000000003) math:sum 1036 .
|
|
230
|
+
# via the schematic forward rule:
|
|
231
|
+
# {
|
|
232
|
+
# ?P :absorbedRed ?Ared .
|
|
233
|
+
# ?P :absorbedBlue ?Ablue .
|
|
234
|
+
# (?Ared ?Ablue) math:sum ?Abs .
|
|
235
|
+
# } => {
|
|
236
|
+
# ?P :absorbedEnergy ?Abs .
|
|
237
|
+
# } .
|
|
238
|
+
# with substitution (on rule variables):
|
|
239
|
+
# ?Ablue = 220.00000000000003
|
|
240
|
+
# ?Abs = 1036
|
|
241
|
+
# ?Ared = 816
|
|
242
|
+
# ?P = :Sunflower
|
|
243
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
244
|
+
# ----------------------------------------------------------------------
|
|
245
|
+
|
|
246
|
+
:Sunflower :absorbedEnergy 1036 .
|
|
247
|
+
|
|
248
|
+
# ----------------------------------------------------------------------
|
|
249
|
+
# Proof for derived triple:
|
|
250
|
+
# :Fern :absorbedEnergy 132 .
|
|
251
|
+
# It holds because the following instance of the rule body is provable:
|
|
252
|
+
# :Fern :absorbedRed 72 .
|
|
253
|
+
# :Fern :absorbedBlue 60 .
|
|
254
|
+
# (72 60) math:sum 132 .
|
|
255
|
+
# via the schematic forward rule:
|
|
256
|
+
# {
|
|
257
|
+
# ?P :absorbedRed ?Ared .
|
|
258
|
+
# ?P :absorbedBlue ?Ablue .
|
|
259
|
+
# (?Ared ?Ablue) math:sum ?Abs .
|
|
260
|
+
# } => {
|
|
261
|
+
# ?P :absorbedEnergy ?Abs .
|
|
262
|
+
# } .
|
|
263
|
+
# with substitution (on rule variables):
|
|
264
|
+
# ?Ablue = 60
|
|
265
|
+
# ?Abs = 132
|
|
266
|
+
# ?Ared = 72
|
|
267
|
+
# ?P = :Fern
|
|
268
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
269
|
+
# ----------------------------------------------------------------------
|
|
270
|
+
|
|
271
|
+
:Fern :absorbedEnergy 132 .
|
|
272
|
+
|
|
273
|
+
# ----------------------------------------------------------------------
|
|
274
|
+
# Proof for derived triple:
|
|
275
|
+
# :Fern :dailyStored 33 .
|
|
276
|
+
# It holds because the following instance of the rule body is provable:
|
|
277
|
+
# :Fern :absorbedEnergy 132 .
|
|
278
|
+
# :Fern :conversion 0.25 .
|
|
279
|
+
# (132 0.25) math:product 33 .
|
|
280
|
+
# via the schematic forward rule:
|
|
281
|
+
# {
|
|
282
|
+
# ?P :absorbedEnergy ?Abs .
|
|
283
|
+
# ?P :conversion ?C .
|
|
284
|
+
# (?Abs ?C) math:product ?Stored .
|
|
285
|
+
# } => {
|
|
286
|
+
# ?P :dailyStored ?Stored .
|
|
287
|
+
# } .
|
|
288
|
+
# with substitution (on rule variables):
|
|
289
|
+
# ?Abs = 132
|
|
290
|
+
# ?C = 0.25
|
|
291
|
+
# ?P = :Fern
|
|
292
|
+
# ?Stored = 33
|
|
293
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
294
|
+
# ----------------------------------------------------------------------
|
|
295
|
+
|
|
296
|
+
:Fern :dailyStored 33 .
|
|
297
|
+
|
|
298
|
+
# ----------------------------------------------------------------------
|
|
299
|
+
# Proof for derived triple:
|
|
300
|
+
# :Sunflower :dailyStored 259 .
|
|
301
|
+
# It holds because the following instance of the rule body is provable:
|
|
302
|
+
# :Sunflower :absorbedEnergy 1036 .
|
|
303
|
+
# :Sunflower :conversion 0.25 .
|
|
304
|
+
# (1036 0.25) math:product 259 .
|
|
305
|
+
# via the schematic forward rule:
|
|
306
|
+
# {
|
|
307
|
+
# ?P :absorbedEnergy ?Abs .
|
|
308
|
+
# ?P :conversion ?C .
|
|
309
|
+
# (?Abs ?C) math:product ?Stored .
|
|
310
|
+
# } => {
|
|
311
|
+
# ?P :dailyStored ?Stored .
|
|
312
|
+
# } .
|
|
313
|
+
# with substitution (on rule variables):
|
|
314
|
+
# ?Abs = 1036
|
|
315
|
+
# ?C = 0.25
|
|
316
|
+
# ?P = :Sunflower
|
|
317
|
+
# ?Stored = 259
|
|
318
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
319
|
+
# ----------------------------------------------------------------------
|
|
320
|
+
|
|
321
|
+
:Sunflower :dailyStored 259 .
|
|
322
|
+
|
|
323
|
+
# ----------------------------------------------------------------------
|
|
324
|
+
# Proof for derived triple:
|
|
325
|
+
# :Sunflower :weeklyStored 1813 .
|
|
326
|
+
# It holds because the following instance of the rule body is provable:
|
|
327
|
+
# :Sunflower :dailyStored 259 .
|
|
328
|
+
# (259 7) math:product 1813 .
|
|
329
|
+
# via the schematic forward rule:
|
|
330
|
+
# {
|
|
331
|
+
# ?P :dailyStored ?D .
|
|
332
|
+
# (?D 7) math:product ?W .
|
|
333
|
+
# } => {
|
|
334
|
+
# ?P :weeklyStored ?W .
|
|
335
|
+
# } .
|
|
336
|
+
# with substitution (on rule variables):
|
|
337
|
+
# ?D = 259
|
|
338
|
+
# ?P = :Sunflower
|
|
339
|
+
# ?W = 1813
|
|
340
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
341
|
+
# ----------------------------------------------------------------------
|
|
342
|
+
|
|
343
|
+
:Sunflower :weeklyStored 1813 .
|
|
344
|
+
|
|
345
|
+
# ----------------------------------------------------------------------
|
|
346
|
+
# Proof for derived triple:
|
|
347
|
+
# :Fern :weeklyStored 231 .
|
|
348
|
+
# It holds because the following instance of the rule body is provable:
|
|
349
|
+
# :Fern :dailyStored 33 .
|
|
350
|
+
# (33 7) math:product 231 .
|
|
351
|
+
# via the schematic forward rule:
|
|
352
|
+
# {
|
|
353
|
+
# ?P :dailyStored ?D .
|
|
354
|
+
# (?D 7) math:product ?W .
|
|
355
|
+
# } => {
|
|
356
|
+
# ?P :weeklyStored ?W .
|
|
357
|
+
# } .
|
|
358
|
+
# with substitution (on rule variables):
|
|
359
|
+
# ?D = 33
|
|
360
|
+
# ?P = :Fern
|
|
361
|
+
# ?W = 231
|
|
362
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
363
|
+
# ----------------------------------------------------------------------
|
|
364
|
+
|
|
365
|
+
:Fern :weeklyStored 231 .
|
|
366
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# -------------
|
|
2
|
+
# Spectral week
|
|
3
|
+
# -------------
|
|
4
|
+
|
|
5
|
+
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
|
|
6
|
+
@prefix list: <http://www.w3.org/2000/10/swap/list#>.
|
|
7
|
+
@prefix : <http://example.org/spectral-week#>.
|
|
8
|
+
|
|
9
|
+
# ------------------------------------------------------------
|
|
10
|
+
# Spectral light intake (red + blue) and weekly energy storage
|
|
11
|
+
# ------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
# Locations: daily hours of red/blue light, and intensity per hour.
|
|
14
|
+
:Greenhouse :redHours 8.0; :blueHours 2.0;
|
|
15
|
+
:redIntensity 120.0;
|
|
16
|
+
:blueIntensity 200.0.
|
|
17
|
+
|
|
18
|
+
:Shade :redHours 3.0; :blueHours 1.0;
|
|
19
|
+
:redIntensity 60.0;
|
|
20
|
+
:blueIntensity 80.0.
|
|
21
|
+
|
|
22
|
+
# Plants with wavelength-dependent absorption + conversion efficiency.
|
|
23
|
+
# absorption is in [0..1], conversion efficiency in [0..1].
|
|
24
|
+
:Sunflower a :Plant; :location :Greenhouse;
|
|
25
|
+
:absorbRed 0.85; :absorbBlue 0.55; :conversion 0.25.
|
|
26
|
+
|
|
27
|
+
:Fern a :Plant; :location :Shade;
|
|
28
|
+
:absorbRed 0.40; :absorbBlue 0.75; :conversion 0.25.
|
|
29
|
+
|
|
30
|
+
# ------------------------------------
|
|
31
|
+
# Compute per-location spectral energy
|
|
32
|
+
# Ered = redIntensity * redHours
|
|
33
|
+
# Eblue = blueIntensity * blueHours
|
|
34
|
+
# ------------------------------------
|
|
35
|
+
|
|
36
|
+
{
|
|
37
|
+
?Loc :redIntensity ?RI; :redHours ?RH.
|
|
38
|
+
(?RI ?RH) math:product ?Ered.
|
|
39
|
+
}
|
|
40
|
+
=>
|
|
41
|
+
{ ?Loc :redEnergy ?Ered. }.
|
|
42
|
+
|
|
43
|
+
{
|
|
44
|
+
?Loc :blueIntensity ?BI; :blueHours ?BH.
|
|
45
|
+
(?BI ?BH) math:product ?Eblue.
|
|
46
|
+
}
|
|
47
|
+
=>
|
|
48
|
+
{ ?Loc :blueEnergy ?Eblue. }.
|
|
49
|
+
|
|
50
|
+
# -------------------------------------------
|
|
51
|
+
# Daily absorbed energy by plant
|
|
52
|
+
# Ared = Loc.redEnergy * Plant.absorbRed
|
|
53
|
+
# Ablue = Loc.blueEnergy * Plant.absorbBlue
|
|
54
|
+
# absorbed = Ared + Ablue
|
|
55
|
+
# -------------------------------------------
|
|
56
|
+
|
|
57
|
+
{
|
|
58
|
+
?P a :Plant; :location ?Loc; :absorbRed ?AR.
|
|
59
|
+
?Loc :redEnergy ?Ered.
|
|
60
|
+
(?Ered ?AR) math:product ?Ared.
|
|
61
|
+
}
|
|
62
|
+
=>
|
|
63
|
+
{ ?P :absorbedRed ?Ared. }.
|
|
64
|
+
|
|
65
|
+
{
|
|
66
|
+
?P a :Plant; :location ?Loc; :absorbBlue ?AB.
|
|
67
|
+
?Loc :blueEnergy ?Eblue.
|
|
68
|
+
(?Eblue ?AB) math:product ?Ablue.
|
|
69
|
+
}
|
|
70
|
+
=>
|
|
71
|
+
{ ?P :absorbedBlue ?Ablue. }.
|
|
72
|
+
|
|
73
|
+
{
|
|
74
|
+
?P :absorbedRed ?Ared.
|
|
75
|
+
?P :absorbedBlue ?Ablue.
|
|
76
|
+
(?Ared ?Ablue) math:sum ?Abs.
|
|
77
|
+
}
|
|
78
|
+
=>
|
|
79
|
+
{ ?P :absorbedEnergy ?Abs. }.
|
|
80
|
+
|
|
81
|
+
# -------------------------------------------------
|
|
82
|
+
# Daily stored energy = absorbedEnergy * conversion
|
|
83
|
+
# -------------------------------------------------
|
|
84
|
+
|
|
85
|
+
{
|
|
86
|
+
?P :absorbedEnergy ?Abs; :conversion ?C.
|
|
87
|
+
(?Abs ?C) math:product ?Stored.
|
|
88
|
+
}
|
|
89
|
+
=>
|
|
90
|
+
{ ?P :dailyStored ?Stored. }.
|
|
91
|
+
|
|
92
|
+
# ------------------------------------
|
|
93
|
+
# Weekly stored energy = dailyStored*7
|
|
94
|
+
# ------------------------------------
|
|
95
|
+
|
|
96
|
+
{
|
|
97
|
+
?P :dailyStored ?D.
|
|
98
|
+
(?D 7) math:product ?W.
|
|
99
|
+
}
|
|
100
|
+
=>
|
|
101
|
+
{
|
|
102
|
+
?P :weeklyStored ?W.
|
|
103
|
+
}.
|
|
104
|
+
|