Skip to content

Commit 707510e

Browse files
committed
Merge branch 'master' of https://github.com/mmlab/RMLProcessor into development
Conflicts: src/test/java/be/ugent/mmlab/rml/MapperTest.java
2 parents e011318 + 7fc9525 commit 707510e

File tree

9 files changed

+196
-9
lines changed

9 files changed

+196
-9
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ target/
1010
nb-configuration.xml
1111
nbactions.xml
1212
gc.log
13-
src/main/java/be/ugent/mmlab/rml/main/Main_1.java
14-
13+
src/main/java/be/ugent/mmlab/rml/main/Main_*.java

src/main/java/be/ugent/mmlab/rml/core/RMLMappingFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ private static PredicateObjectMap extractPredicateObjectMap(
373373
+ predicateObject.stringValue()
374374
+ " has no predicate map defined : one or more is required.");
375375
}
376+
376377
Set<PredicateMap> predicateMaps = new HashSet<PredicateMap>();
377378
try {
378379
for (Statement statement : statements) {

src/main/java/be/ugent/mmlab/rml/processor/AbstractRMLProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ public List<Value> processObjectMap(ObjectMap objectMap, Object node) {
396396
valueList.add(new BNodeImpl(value));
397397
break;
398398
case LITERAL:
399-
if (objectMap.getLanguageTag() != null) {
399+
if (objectMap.getLanguageTag() != null && !value.equals("")) {
400400
valueList.add(new LiteralImpl(value, objectMap.getLanguageTag()));
401401
} else if (value != null && !value.equals("") && objectMap.getDataType() != null) {
402402
valueList.add(new LiteralImpl(value, objectMap.getDataType()));

src/main/java/be/ugent/mmlab/rml/processor/concrete/JSONPathProcessor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public List<String> extractValueFromNode(Object node, String expression) {
6161
JSONArray arr = (JSONArray) val;
6262
return Arrays.asList(arr.toArray(new String[0]));
6363
}
64-
6564
list.add((String) val.toString());
6665
return list;
6766
} catch (com.jayway.jsonpath.InvalidPathException ex) {

src/test/java/be/ugent/mmlab/rml/MapperTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ public void testExample4() {
7070
assertTrue(desiredOutput(fileToOutputFile).isEqualTo(assertMap(fileToRMLFile)));
7171
}
7272

73-
public void testExample5() {
73+
/*public void testExample5() {
7474
URL fileToRMLFile = getClass().getResource("/example5/museum-model.rml.ttl");
7575
URL fileToOutputFile = getClass().getResource("/example5/museum.output.ttl");
7676
assertTrue(desiredOutput(fileToOutputFile).isEqualTo(assertMap(fileToRMLFile)));
7777
}
78+
}*/
7879

7980
public void testExample6() {
8081
URL fileToRMLFile = getClass().getResource("/example6/example.rml.ttl");

src/test/resources/example5/museum-model.rml.ttl

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,27 @@
66
@prefix ex: <http://example.com/>.
77
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
88

9+
10+
<#SitterMapping>
11+
rml:logicalSource [
12+
rml:source "museum.json";
13+
rml:referenceFormulation ql:JSONPath;
14+
rml:iterator "$.Sitter";
15+
];
16+
rr:subjectMap [
17+
rr:template "http://ex.com/{Name}";
18+
rr:class crm:E21_Person ;
19+
];
20+
21+
rr:predicateObjectMap
22+
[
23+
rr:predicate rdfs:label;
24+
rr:objectMap
25+
[
26+
rml:reference "Name"
27+
]
28+
].
29+
930
<#ProductionMapping>
1031
rml:logicalSource [
1132
rml:source "/example5/museum.json";
@@ -42,6 +63,7 @@
4263
];
4364
].
4465

66+
4567
<#ArtworkMapping>
4668
rml:logicalSource [
4769
rml:source "/example5/museum.json";
@@ -79,7 +101,8 @@
79101
rr:parentTriplesMap <#SitterMapping> ;
80102
];
81103
].
82-
104+
105+
83106
<#ArtistMapping>
84107
rml:logicalSource [
85108
rml:source "/example5/museum.json";
@@ -105,7 +128,7 @@
105128
[
106129
rr:predicate crm:P14_carried_out_by;
107130
rr:objectMap [
108-
rr:parentTriplesMap <#WikipediaExportMapping> ;
131+
rr:parentTriplesMap <#MoonWalkersMapping> ;
109132
rr:joinCondition [
110133
rr:child "Artist";
111134
rr:parent "Name";
@@ -114,7 +137,7 @@
114137
].
115138

116139

117-
<#SitterMapping>
140+
<#MoonWalkersMapping>
118141
rml:logicalSource [
119142
rml:source "/example5/museum.json";
120143
rml:referenceFormulation ql:JSONPath;
@@ -183,4 +206,4 @@
183206
[
184207
rml:reference "Service"
185208
]
186-
].
209+
].
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
2+
<http://ex.com/Neil+Armstrong> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.cidoc-crm.org/cidoc-crm/E21_Person> .
3+
#<http://ex.com/Neil+Armstrong> <http://www.w3.org/2000/01/rdf-schema#label> "Neil Armstrong" .
4+
<http://ex.com/Buzz+Aldrin> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.cidoc-crm.org/cidoc-crm/E21_Person> .
5+
#<http://ex.com/Buzz+Aldrin> <http://www.w3.org/2000/01/rdf-schema#label> "Buzz Aldrin" .
6+
<http://ex.com/Henry+Larcom+Abbot> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.cidoc-crm.org/cidoc-crm/E21_Person> .
7+
#<http://ex.com/Henry+Larcom+Abbot> <http://www.w3.org/2000/01/rdf-schema#label> "Henry Larcom Abbot" .
8+
9+
10+
<http://ex.com/Neil+Armstrong> <http://example.com/service> "NASA" ;
11+
<http://example.com/deathday> "2012-08-25"^^<http://www.w3.org/2001/XMLSchema#date> ;
12+
<http://example.com/birthday> "1930-08-05"^^<http://www.w3.org/2001/XMLSchema#date> ;
13+
<http://example.com/evaday> "1969-07-21"^^<http://www.w3.org/2001/XMLSchema#date> .
14+
15+
<http://ex.com/Buzz+Aldrin> a <http://www.cidoc-crm.org/cidoc-crm/E21_Person> ;
16+
<http://example.com/service> "Air Force" ;
17+
#<http://example.com/deathday> ""^^<http://www.w3.org/2001/XMLSchema#date> ;
18+
<http://example.com/birthday> "1930-01-20"^^<http://www.w3.org/2001/XMLSchema#date> ;
19+
<http://example.com/evaday> "1969-07-21"^^<http://www.w3.org/2001/XMLSchema#date> .
20+
21+
<http://ex.com/Pete+Conrad> a <http://www.cidoc-crm.org/cidoc-crm/E21_Person> ;
22+
<http://example.com/service> "Navy" ;
23+
<http://example.com/deathday> "1999-07-08"^^<http://www.w3.org/2001/XMLSchema#date> ;
24+
<http://example.com/birthday> "1930-06-02"^^<http://www.w3.org/2001/XMLSchema#date> ;
25+
<http://example.com/evaday> "1969-11-19"^^<http://www.w3.org/2001/XMLSchema#date> .
26+
27+
<http://ex.com/Alan+Bean> a <http://www.cidoc-crm.org/cidoc-crm/E21_Person> ;
28+
<http://example.com/service> "Navy" ;
29+
#<http://example.com/deathday> ""^^<http://www.w3.org/2001/XMLSchema#date> ;
30+
<http://example.com/birthday> "1932-03-15"^^<http://www.w3.org/2001/XMLSchema#date> ;
31+
<http://example.com/evaday> "1969-11-19"^^<http://www.w3.org/2001/XMLSchema#date> .
32+
33+
<http://ex.com/Alan+Shepard> a <http://www.cidoc-crm.org/cidoc-crm/E21_Person> ;
34+
<http://example.com/service> "Navy" ;
35+
<http://example.com/deathday> "1998-07-21"^^<http://www.w3.org/2001/XMLSchema#date> ;
36+
<http://example.com/birthday> "1923-11-18"^^<http://www.w3.org/2001/XMLSchema#date> ;
37+
<http://example.com/evaday> "1971-02-05"^^<http://www.w3.org/2001/XMLSchema#date> .
38+
39+
<http://ex.com/Edgar+Mitchell> a <http://www.cidoc-crm.org/cidoc-crm/E21_Person> ;
40+
<http://example.com/service> "Navy" ;
41+
#<http://example.com/deathday> ""^^<http://www.w3.org/2001/XMLSchema#date> ;
42+
<http://example.com/birthday> "1930-09-17"^^<http://www.w3.org/2001/XMLSchema#date> ;
43+
<http://example.com/evaday> "1971-02-05"^^<http://www.w3.org/2001/XMLSchema#date> .
44+
45+
<http://ex.com/David+Scott> a <http://www.cidoc-crm.org/cidoc-crm/E21_Person> ;
46+
<http://example.com/service> "Air Force" ;
47+
#<http://example.com/deathday> ""^^<http://www.w3.org/2001/XMLSchema#date> ;
48+
<http://example.com/birthday> "1932-06-06"^^<http://www.w3.org/2001/XMLSchema#date> ;
49+
<http://example.com/evaday> "1971-07-31"^^<http://www.w3.org/2001/XMLSchema#date> .
50+
51+
<http://ex.com/James+Irwin> a <http://www.cidoc-crm.org/cidoc-crm/E21_Person> ;
52+
<http://example.com/service> "Air Force" ;
53+
<http://example.com/deathday> "1991-08-08"^^<http://www.w3.org/2001/XMLSchema#date> ;
54+
<http://example.com/birthday> "1930-03-17"^^<http://www.w3.org/2001/XMLSchema#date> ;
55+
<http://example.com/evaday> "1971-07-31"^^<http://www.w3.org/2001/XMLSchema#date> .
56+
57+
<http://ex.com/John+Young> a <http://www.cidoc-crm.org/cidoc-crm/E21_Person> ;
58+
<http://example.com/service> "Navy" ;
59+
#<http://example.com/deathday> ""^^<http://www.w3.org/2001/XMLSchema#date> ;
60+
<http://example.com/birthday> "1930-09-24"^^<http://www.w3.org/2001/XMLSchema#date> ;
61+
<http://example.com/evaday> "1972-04-21"^^<http://www.w3.org/2001/XMLSchema#date> .
62+
63+
<http://ex.com/Charles+Duke> a <http://www.cidoc-crm.org/cidoc-crm/E21_Person> ;
64+
<http://example.com/service> "Air Force" ;
65+
#<http://example.com/deathday> ""^^<http://www.w3.org/2001/XMLSchema#date> ;
66+
<http://example.com/birthday> "1935-10-03"^^<http://www.w3.org/2001/XMLSchema#date> ;
67+
<http://example.com/evaday> "1972-04-21"^^<http://www.w3.org/2001/XMLSchema#date> .
68+
69+
<http://ex.com/Eugene+Cernan> a <http://www.cidoc-crm.org/cidoc-crm/E21_Person> ;
70+
<http://example.com/service> "Navy" ;
71+
#<http://example.com/deathday> ""^^<http://www.w3.org/2001/XMLSchema#date> ;
72+
<http://example.com/birthday> "1934-03-14"^^<http://www.w3.org/2001/XMLSchema#date> ;
73+
<http://example.com/evaday> "1972-12-11"^^<http://www.w3.org/2001/XMLSchema#date> .
74+
75+
<http://ex.com/Harrison+Schmitt> a <http://www.cidoc-crm.org/cidoc-crm/E21_Person> ;
76+
<http://example.com/service> "NASA" ;
77+
#<http://example.com/deathday> ""^^<http://www.w3.org/2001/XMLSchema#date> ;
78+
<http://example.com/birthday> "1935-07-03"^^<http://www.w3.org/2001/XMLSchema#date> ;
79+
<http://example.com/evaday> "1972-12-11"^^<http://www.w3.org/2001/XMLSchema#date> .
80+
81+
<http://ex.com/Henry+Larcom+Abbot> a <http://www.cidoc-crm.org/cidoc-crm/E21_Person> ;
82+
#<http://example.com/service> "" ;
83+
<http://example.com/deathday> "1927-10-01"^^<http://www.w3.org/2001/XMLSchema#date> ;
84+
<http://example.com/birthday> "1831-08-13"^^<http://www.w3.org/2001/XMLSchema#date> ;
85+
#<http://example.com/evaday> ""^^<http://www.w3.org/2001/XMLSchema#date> .
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
@prefix rr: <http://www.w3.org/ns/r2rml#>.
2+
@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
3+
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .
4+
@prefix crm: <http://www.cidoc-crm.org/cidoc-crm/> .
5+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
6+
@prefix ex: <http://example.com/>.
7+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
8+
9+
<#MoonWalkersMapping>
10+
rml:logicalSource [
11+
rml:sourceName "moon-walkers7.csv";
12+
rml:queryLanguage ql:CSV;
13+
];
14+
rr:subjectMap [
15+
rr:template "http://ex.com/{Name}";
16+
rr:class crm:E21_Person ;
17+
];
18+
19+
# rr:predicateObjectMap
20+
# [
21+
# rr:predicate rdfs:label;
22+
# rr:objectMap
23+
# [
24+
# rml:reference "Name";
25+
# ]
26+
# ];
27+
28+
rr:predicateObjectMap
29+
[
30+
rr:predicate ex:birthday;
31+
rr:objectMap
32+
[
33+
rml:reference "Birth Date";
34+
rr:datatype xsd:date;
35+
]
36+
];
37+
38+
rr:predicateObjectMap
39+
[
40+
rr:predicate ex:deathday;
41+
rr:objectMap
42+
[
43+
rml:reference "Death Date";
44+
rr:datatype xsd:date;
45+
]
46+
];
47+
48+
rr:predicateObjectMap
49+
[
50+
rr:predicate ex:evaday;
51+
rr:objectMap
52+
[
53+
rml:reference "EVA Date" ;
54+
rr:datatype xsd:date;
55+
]
56+
];
57+
58+
rr:predicateObjectMap
59+
[
60+
rr:predicate ex:service;
61+
rr:objectMap
62+
[
63+
rml:reference "Service"
64+
]
65+
].
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Name,Birth Date,Death Date,Mission,EVA Date,Service
2+
Neil Armstrong,1930-08-05,2012-08-25,Apollo 11,1969-07-21,NASA
3+
Buzz Aldrin,1930-01-20,,Apollo 11,1969-07-21,Air Force
4+
Pete Conrad,1930-06-02,1999-07-08,Apollo 12,1969-11-19,Navy
5+
Alan Bean,1932-03-15,,Apollo 12,1969-11-19,Navy
6+
Alan Shepard,1923-11-18,1998-07-21,Apollo 14,1971-02-05,Navy
7+
Edgar Mitchell,1930-09-17,,Apollo 14,1971-02-05,Navy
8+
David Scott,1932-06-06,,Apollo 15,1971-07-31,Air Force
9+
James Irwin,1930-03-17,1991-08-08,Apollo 15,1971-07-31,Air Force
10+
John Young,1930-09-24,,Apollo 16,1972-04-21,Navy
11+
Charles Duke,1935-10-03,,Apollo 16,1972-04-21,Air Force
12+
Eugene Cernan,1934-03-14,,Apollo 17,1972-12-11,Navy
13+
Harrison Schmitt,1935-07-03,,Apollo 17,1972-12-11,NASA
14+
Henry Larcom Abbot,1831-08-13,1927-10-01,,

0 commit comments

Comments
 (0)