Skip to content

Commit

Permalink
Add RML example
Browse files Browse the repository at this point in the history
  • Loading branch information
fils committed Jul 28, 2023
1 parent caec7ff commit 4bb9ae2
Show file tree
Hide file tree
Showing 9 changed files with 251 additions and 0 deletions.
Binary file added code/RML/PeaceBoat.ods
Binary file not shown.
17 changes: 17 additions & 0 deletions code/RML/PeaceBoatODIS.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
id,Location,Organization,Number of People in Group,Date (dd/mm/yy),Time ,Recent Precipitation ,Land Surrounding Site ,Monitoring Kit Used,Other Observations ,Air Temperature,Degrees C ,Dissolved Oxygen (ppm),Water Temperature (Celsius),pH,Turbidity (JTU),% Oxygen Saturation
1,London,Peace Boat US,6,26/05/23,5:11pm,Clear Skies,Park,EEWC Kit,Fresh Water,19,,6,18,8,25,64
2,London,Peace Boat US,3,26/05/23,5:10pm,Clear Skies,Park,EEWC Kit,Fresh Water,19,,4,20,8,40,43
3,London,Peace Boat US,5,26/05/23,5:10pm,Clear Skies,Park,EEWC Kit,Fresh Water,19,,6,20,7,10,64
4,Andalsnes,Peace Boat US,4,31/05/23,8:52am,Cloudy,Port Town,EEWC Kit,Salt Water; near a port with ships,6,,0,10,7,0,0
5,Andalsnes,Peace Boat US,4,31/05/23,8:51am,Cloudy,Port Town,EEWC Kit,Salt Water; near a port with ships,6,,6,10,7,0,50
6,Andalsnes,Peace Boat US,4,31/05/23,8:51am,Cloudy,Port Town,EEWC Kit,Salt Water; near a port with ships,6,,6,6,7,0,48
7,Tromso (Gasvaer),Peace Boat US,4,2/6/2023,11:22am,Cloudy ,Coastal Island ,EEWC Kit ,Salt Water ,5,,8,6,7,0,64
8,Tromso (Gasvaer),Peace Boat US,3,2/6/2023,11:22am,Cloudy ,Coastal Island ,EEWC Kit,Salt Water ,5,,2,4,7,0,16
9,Tromso (Gasvaer),Peace Boat US,4,2/6/2023,11:22am,Cloudy ,Coastal Island,EEWC Kit,Salt Water ,5,,6,4,7,0,46
10,Longyearbyen,Peace Boat US,4,5/6/2023,11:26pm,Clear Skies,Port Town,EEWC Kit,Salt Water; near a port; near an industrial area,1,,4,4,7,40,31
11,Longyearbyen,Peace Boat US,5,5/6/2023,11:26pm,Clear Skies,Port Town,EEWC Kit,Salt Water; near a port; near an industrial area,1,,6,4,7,40,46
12,Longyearbyen,Peace Boat US,4,5/6/2023,11:26pm,Clear Skies,Port Town,EEWC Kit,Salt Water; near a port; near an industrial area,1,,2,2,6.5,15,15
13,Akureyri,Peace Boat US,4,9/6/2023,8:57pm,Cloudy ,Port Town,EEWC Kit,Salt Water; near a port ,10,,n/a,6,8,40,n/a
14,Akureyri,Peace Boat US,6,9/6/2023,8:57pm ,Cloudy ,Port Town,EEWC Kit,Salt Water; near a port ,10,,6,8,7,10,51
15,Akureyri,Peace Boat US,4,9/6/2023,8:57pm ,Cloudy ,Port Town,EEWC Kit,Salt Water; near a port ,10,,7,8,7,20,51
16,Reykjavik ,Peace Boat US,7,12/6/2023,1:52pm,Clody,Port Town,EEWC Kit,Salt Water,12,,4,6,7,40,32
17 changes: 17 additions & 0 deletions code/RML/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# RML Notes

## Notes


Note the example.ttl has in it a triple that defines the CSV source URL.

```bash
java -jar rmlmapper-6.2.1-r368-all.jar -m example.ttl -o output.json -s jsonld
```

serialization formats can be (nquads (default), trig, trix, jsonld, hdt)


## Scratch

[ rr:template "http://genid/org/X/{id}" ]
3 changes: 3 additions & 0 deletions code/RML/characters.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id firstname lastname hair
0 Ash Ketchum black
1 Misty orange
53 changes: 53 additions & 0 deletions code/RML/example.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .
@prefix csvw: <http://www.w3.org/ns/csvw#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <http://example.org/rules/> .
@prefix schema: <http://schema.org/> .
@prefix dbo: <http://dbpedia.org/ontology/> .

:TriplesMap a rr:TriplesMap;
rml:logicalSource [
rml:source [
a csvw:Table;
csvw:url "characters.tsv";
csvw:dialect [
a csvw:Dialect;
csvw:delimiter "\t"
]
];
rml:referenceFormulation ql:CSV
].

:TriplesMap rr:subjectMap [
rr:template "http://example.org/character/{id}"
].

:TriplesMap rr:predicateObjectMap [
rr:predicate rdf:type;
rr:objectMap [
rr:constant schema:Person
]
].

:TriplesMap rr:predicateObjectMap [
rr:predicate schema:givenName;
rr:objectMap [
rml:reference "firstname"
]
].

:TriplesMap rr:predicateObjectMap [
rr:predicate schema:lastName;
rr:objectMap [
rml:reference "lastname"
]
].

:TriplesMap rr:predicateObjectMap [
rr:predicate dbo:hairColor;
rr:objectMap [
rml:reference "hair"
]
].
25 changes: 25 additions & 0 deletions code/RML/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[ {
"@id" : "http://example.org/character/0",
"@type" : [ "http://schema.org/Person" ],
"http://dbpedia.org/ontology/hairColor" : [ {
"@value" : "black"
} ],
"http://schema.org/givenName" : [ {
"@value" : "Ash"
} ],
"http://schema.org/lastName" : [ {
"@value" : "Ketchum"
} ]
}, {
"@id" : "http://example.org/character/1",
"@type" : [ "http://schema.org/Person" ],
"http://dbpedia.org/ontology/hairColor" : [ {
"@value" : "orange"
} ],
"http://schema.org/givenName" : [ {
"@value" : "Misty"
} ],
"http://schema.org/lastName" : [ {
"@value" : ""
} ]
} ]
72 changes: 72 additions & 0 deletions code/RML/peaceMap.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .
@prefix csvw: <http://www.w3.org/ns/csvw#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <http://example.org/rules/> .
@prefix schema: <http://schema.org/> .
@prefix dbo: <http://dbpedia.org/ontology/> .

:TriplesMap a rr:TriplesMap;
rml:logicalSource [
rml:source [
a csvw:Table;
csvw:url "PeaceBoatODIS.csv";
csvw:dialect [
a csvw:Dialect;
csvw:delimiter ","
]
];
rml:referenceFormulation ql:CSV
].

:TriplesMap rr:subjectMap [
rr:template "http://peaceboat.org/dataset/X/{id}"
].

:TriplesMap rr:predicateObjectMap [
rr:predicate rdf:type;
rr:objectMap [
rr:constant schema:Measurement
]
].

:TriplesMap rr:predicateObjectMap [
rr:predicate schema:author;
rr:objectMap [
rr:template "http://genid/org/X/{id}"
]
].


:OrgMap a rr:TriplesMap;
rml:logicalSource [
rml:source [
a csvw:Table;
csvw:url "PeaceBoatODIS.csv";
csvw:dialect [
a csvw:Dialect;
csvw:delimiter ","
]
];
rml:referenceFormulation ql:CSV
].

:OrgMap rr:subjectMap [
rr:template "http://genid/org/X/{id}"
].

:OrgMap rr:predicateObjectMap [
rr:predicate rdf:type;
rr:objectMap [
rr:constant schema:Organization
]
].


:OrgMap rr:predicateObjectMap [
rr:predicate schema:name;
rr:objectMap [
rml:reference "Organization"
]
].
64 changes: 64 additions & 0 deletions code/RML/peaceout.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<http://example.org/character/1> <http://schema.org/value> "19".
<http://example.org/character/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/1> <http://schema.org/PeopleInGroup> "6".
<http://example.org/character/1> <http://schema.org/dateIssued> "26/05/23".
<http://example.org/character/2> <http://schema.org/value> "19".
<http://example.org/character/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/2> <http://schema.org/PeopleInGroup> "3".
<http://example.org/character/2> <http://schema.org/dateIssued> "26/05/23".
<http://example.org/character/3> <http://schema.org/value> "19".
<http://example.org/character/3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/3> <http://schema.org/PeopleInGroup> "5".
<http://example.org/character/3> <http://schema.org/dateIssued> "26/05/23".
<http://example.org/character/4> <http://schema.org/value> "6".
<http://example.org/character/4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/4> <http://schema.org/PeopleInGroup> "4".
<http://example.org/character/4> <http://schema.org/dateIssued> "31/05/23".
<http://example.org/character/5> <http://schema.org/value> "6".
<http://example.org/character/5> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/5> <http://schema.org/PeopleInGroup> "4".
<http://example.org/character/5> <http://schema.org/dateIssued> "31/05/23".
<http://example.org/character/6> <http://schema.org/value> "6".
<http://example.org/character/6> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/6> <http://schema.org/PeopleInGroup> "4".
<http://example.org/character/6> <http://schema.org/dateIssued> "31/05/23".
<http://example.org/character/7> <http://schema.org/value> "5".
<http://example.org/character/7> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/7> <http://schema.org/PeopleInGroup> "4".
<http://example.org/character/7> <http://schema.org/dateIssued> "2/6/2023".
<http://example.org/character/8> <http://schema.org/value> "5".
<http://example.org/character/8> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/8> <http://schema.org/PeopleInGroup> "3".
<http://example.org/character/8> <http://schema.org/dateIssued> "2/6/2023".
<http://example.org/character/9> <http://schema.org/value> "5".
<http://example.org/character/9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/9> <http://schema.org/PeopleInGroup> "4".
<http://example.org/character/9> <http://schema.org/dateIssued> "2/6/2023".
<http://example.org/character/10> <http://schema.org/value> "1".
<http://example.org/character/10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/10> <http://schema.org/PeopleInGroup> "4".
<http://example.org/character/10> <http://schema.org/dateIssued> "5/6/2023".
<http://example.org/character/11> <http://schema.org/value> "1".
<http://example.org/character/11> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/11> <http://schema.org/PeopleInGroup> "5".
<http://example.org/character/11> <http://schema.org/dateIssued> "5/6/2023".
<http://example.org/character/12> <http://schema.org/value> "1".
<http://example.org/character/12> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/12> <http://schema.org/PeopleInGroup> "4".
<http://example.org/character/12> <http://schema.org/dateIssued> "5/6/2023".
<http://example.org/character/13> <http://schema.org/value> "10".
<http://example.org/character/13> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/13> <http://schema.org/PeopleInGroup> "4".
<http://example.org/character/13> <http://schema.org/dateIssued> "9/6/2023".
<http://example.org/character/14> <http://schema.org/value> "10".
<http://example.org/character/14> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/14> <http://schema.org/PeopleInGroup> "6".
<http://example.org/character/14> <http://schema.org/dateIssued> "9/6/2023".
<http://example.org/character/15> <http://schema.org/value> "10".
<http://example.org/character/15> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/15> <http://schema.org/PeopleInGroup> "4".
<http://example.org/character/15> <http://schema.org/dateIssued> "9/6/2023".
<http://example.org/character/16> <http://schema.org/value> "12".
<http://example.org/character/16> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Measurement>.
<http://example.org/character/16> <http://schema.org/PeopleInGroup> "7".
<http://example.org/character/16> <http://schema.org/dateIssued> "12/6/2023".
Binary file added code/RML/rmlmapper-6.2.1-r368-all.jar
Binary file not shown.

0 comments on commit 4bb9ae2

Please sign in to comment.