eyeling 1.6.0 → 1.6.2

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.
@@ -0,0 +1,84 @@
1
+ # alignment-demo.n3
2
+ # Minimal alignment example (SKOS mappings + inferred roll-up to a reference concept)
3
+
4
+ @prefix ex: <http://example.org/> .
5
+ @prefix ref: <http://example.org/taxonomy/ref/> .
6
+ @prefix tel: <http://example.org/taxonomy/telraam/> .
7
+ @prefix anpr: <http://example.org/taxonomy/anpr/> .
8
+
9
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
10
+ @prefix log: <http://www.w3.org/2000/10/swap/log#> .
11
+ @prefix list: <http://www.w3.org/2000/10/swap/list#> .
12
+
13
+ ######################################################################
14
+ # 1) Minimal concepts (3 schemes)
15
+ ######################################################################
16
+
17
+ ref:Car a skos:Concept ; skos:prefLabel "Car (reference reporting class)"@en .
18
+
19
+ tel:Car a skos:Concept ; skos:prefLabel "Telraam car"@en .
20
+ tel:HeavyVehicle a skos:Concept ; skos:prefLabel "Telraam heavy vehicle"@en .
21
+
22
+ anpr:VehicleWithPlate a skos:Concept ; skos:prefLabel "ANPR: vehicle with plate"@en .
23
+ anpr:PassengerCar a skos:Concept ; skos:prefLabel "ANPR: passenger car"@en ;
24
+ skos:broader anpr:VehicleWithPlate .
25
+
26
+ ######################################################################
27
+ # 2) Alignments (cross-scheme mappings)
28
+ ######################################################################
29
+
30
+ # Telraam categories mapped to the reference reporting class
31
+ tel:Car skos:broadMatch ref:Car .
32
+ tel:HeavyVehicle skos:broadMatch ref:Car .
33
+
34
+ # ANPR top concept mapped to reference reporting class
35
+ anpr:VehicleWithPlate skos:broadMatch ref:Car .
36
+
37
+ ######################################################################
38
+ # 3) Generic SKOS-ish rules needed for alignment reasoning
39
+ ######################################################################
40
+
41
+ # Treat skos:broadMatch as a "broader-than" link for roll-up
42
+ { ?a skos:broadMatch ?b. } => { ?a skos:broader ?b. } .
43
+
44
+ # Inverse broader/narrower
45
+ { ?n skos:broader ?b. } => { ?b skos:narrower ?n. } .
46
+
47
+ # Transitive closure seeds
48
+ { ?n skos:broader ?b. } => { ?n skos:broaderTransitive ?b. } .
49
+ { ?n skos:narrower ?c. } => { ?n skos:narrowerTransitive ?c. } .
50
+
51
+ # Transitivity
52
+ { ?a skos:broaderTransitive ?b. ?b skos:broaderTransitive ?c. } => { ?a skos:broaderTransitive ?c. } .
53
+ { ?a skos:narrowerTransitive ?b. ?b skos:narrowerTransitive ?c. } => { ?a skos:narrowerTransitive ?c. } .
54
+
55
+ # Keep transitive props inverse too (handy for downstream rules)
56
+ { ?a skos:broaderTransitive ?b. } => { ?b skos:narrowerTransitive ?a. } .
57
+ { ?a skos:narrowerTransitive ?b. } => { ?b skos:broaderTransitive ?a. } .
58
+
59
+ ######################################################################
60
+ # 4) One derived relation used by aggregation/queries:
61
+ # "datasetConcept is narrower-or-equal to referenceConcept"
62
+ ######################################################################
63
+
64
+ # Reflexive
65
+ { ?c a skos:Concept. } => { ?c ex:narrowerOrEqualOf ?c. } .
66
+
67
+ # Anything whose broaderTransitive reaches a concept contributes to that concept
68
+ { ?c skos:broaderTransitive ?b. } => { ?c ex:narrowerOrEqualOf ?b. } .
69
+
70
+ ######################################################################
71
+ # 5) Tiny “demo output” rule: flag concepts that roll up to ref:Car
72
+ ######################################################################
73
+
74
+ { ?x ex:narrowerOrEqualOf ref:Car. } => { ?x ex:rollsUpTo ref:Car. } .
75
+
76
+ ######################################################################
77
+ # Expected inferences (you should see these appear as derived facts):
78
+ #
79
+ # tel:Car ex:rollsUpTo ref:Car .
80
+ # tel:HeavyVehicle ex:rollsUpTo ref:Car .
81
+ # anpr:VehicleWithPlate ex:rollsUpTo ref:Car .
82
+ # anpr:PassengerCar ex:rollsUpTo ref:Car . # via broader anpr:VehicleWithPlate + mapping
83
+ ######################################################################
84
+
@@ -0,0 +1,38 @@
1
+ # ------------------------------------------------------------
2
+ # Minimal SKOS alignment + propagation example
3
+ #
4
+ # Goal:
5
+ # Show how a SKOS mapping (broadMatch) lets you treat dataset-
6
+ # specific categories as a reference category, and how that
7
+ # alignment propagates to more specific (narrower) categories.
8
+ #
9
+ # What should be inferred:
10
+ # anpr:VehicleWithPlate ex:treatedAs ref:Car .
11
+ # anpr:PassengerCar ex:treatedAs ref:Car .
12
+ #
13
+ # Run (example):
14
+ # eyeling minimal-skos-alignment.n3
15
+ # ------------------------------------------------------------
16
+
17
+ @prefix ex: <http://example.org/> .
18
+ @prefix ref: <http://example.org/ref/> .
19
+ @prefix anpr: <http://example.org/anpr/> .
20
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
21
+
22
+ # --- Concepts (two schemes) ---
23
+ ref:Car a skos:Concept .
24
+
25
+ anpr:VehicleWithPlate a skos:Concept ;
26
+ skos:broadMatch ref:Car .
27
+
28
+ anpr:PassengerCar a skos:Concept ;
29
+ skos:broader anpr:VehicleWithPlate .
30
+
31
+ # --- Rules ---
32
+ # Rule 1: interpret skos:broadMatch as "treat A as B" for reporting
33
+ { ?a skos:broadMatch ?b. } => { ?a ex:treatedAs ?b. } .
34
+
35
+ # Rule 2: propagate that treatment down the SKOS hierarchy:
36
+ # if X has broader concept Y, and Y is treatedAs Z, then X is treatedAs Z
37
+ { ?x skos:broader ?y. ?y ex:treatedAs ?z. } => { ?x ex:treatedAs ?z. } .
38
+