unit_ex.n3
1.33 KB
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
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix un: <http://www.w3.org/2007/ont/unit#> .
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
@prefix o2: <http://www.w3.org/2007/ont/o2#>.
@prefix : <unit_ex#>.
@prefix ex: <unit_ex#>.
@keywords a, is, of.
# numeric multiplication associates with unit multiplication
{ (?U1 ?S1) un:product ?U2.
(?U2 ?S2) un:product ?U3.
(?S1 ?S2) math:product ?S3
} => { (?U1 ?S3) un:product ?U3 }.
# scalar conversions between units
{ ?X ?UNIT ?V.
(?BASE ?CONVERSION) un:product ?UNIT.
(?V ?CONVERSION) math:product ?V2.
} => { ?X ?BASE ?V2 }.
# property chaining: shortening
{ ?S ?P1 [ ?P2 ?O].
(?P1 ?P2) o2:chain ?P3
} => { ?S ?P3 ?O }.
# normalizing unit chains by expansion:
# (hmm... this would work better if derived
# units were defined by chaining one property
# at the beginning of the list each time, I think).
{ ?U1 a un:Unit; is o2:chain of (?U2 ?U).
?U2 is o2:chain of (?U3 ?U4).
} => { ?U1 is o2:chain of (?U3 ?U4 ?U) }.
# pushing conversion factors into chains, one case:
{
(?BASIC ?CONVERSION) un:product ?DERIVED.
(?BASIC ?U1) o2:chain ?UCB.
(?DERIVED ?U1) o2:chain ?UCD.
} => { (?UCB ?CONVERSION) un:product ?UCD }.
# examples...
# test for scalar conversions
track length [ un:mile 0.25].
# test for inverses
(un:foot un:hz) o2:chain fps.
bullet speed [ fps 4000 ].