-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspaceship-test.n3
53 lines (47 loc) · 1.2 KB
/
spaceship-test.n3
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
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
@prefix nary: <http://gallows.inf.ed.ac.uk/schema/n-ary#> .
## a curried predicate embedding the kilogram unit
:massInKilograms a nary:BinaryRelation ;
nary:reifiedType :MassObservation ;
nary:subjectPredicate :system ;
nary:objectPredicate :value ;
nary:arg [
nary:predicate :unit ;
nary:object :kg
] .
## a curried predicate embedding the pounds unit
:massInPounds a nary:BinaryRelation ;
nary:reifiedType :MassObservation ;
nary:subjectPredicate :system ;
nary:objectPredicate :value ;
nary:arg [
nary:predicate :unit ;
nary:object :lb
] .
## a unit conversion description
[
a :Conversion ;
:fromUnit :kg ;
:toUnit :lb ;
:factor 2.2
] .
## a simplistic rule for converting units
{
?obs a :MassObservation ;
:system ?sys ;
:value ?val ;
:unit ?unit .
?conv a :Conversion ;
:fromUnit ?unit ;
:toUnit ?toUnit ;
:factor ?factor .
(?val ?factor) math:prod ?toVal .
} => {
[
a :MassObservation ;
:system ?sys ;
:value ?toVal ;
:unit ?toUnit
] .
} .
:s1 :massInKilograms 1000.0 .