Skip to content

Commit a15de12

Browse files
committed
Merge pull request #2 from ubbdst/river-marcus-admin
Possibility to rename resource URI
2 parents 8424ec1 + 45511e9 commit a15de12

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

src/main/java/org/elasticsearch/river/eea_rdf/support/Harvester.java

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,11 +1052,20 @@ private Map<String, ArrayList<String>> getJsonMap(Resource rs, Set<Property> pro
10521052

10531053
if(addUriForResource) {
10541054
results.add("\"" + rs.toString() + "\"");
1055-
jsonMap.put(
1056-
"http://www.w3.org/1999/02/22-rdf-syntax-ns#about",
1057-
results);
1055+
String uriForResource = "http://www.w3.org/1999/02/22-rdf-syntax-ns#about";
1056+
String normalizedProperty = "";
1057+
//If a property is defined in the normProp list,
1058+
//then use normalized(shorten) property.
1059+
if (normalizeProp.containsKey(uriForResource)){
1060+
normalizedProperty = normalizeProp.get(uriForResource);
1061+
}
1062+
//Otherwise use the full uri for the resource
1063+
else{
1064+
normalizedProperty = uriForResource;
1065+
}
1066+
1067+
jsonMap.put(normalizedProperty , results);
10581068
}
1059-
10601069
Set<String> rdfLanguages = new HashSet<String>();
10611070

10621071
for(Property prop: properties) {
@@ -1446,15 +1455,15 @@ private String getLabelForUriFromTDB(String uri, Dataset dataset){
14461455
**/
14471456
private String getInnerQueryForLabel(String uri){
14481457

1449-
String options = "";
1450-
String bind = "";
1451-
int count = 0;
1452-
String labelCoalesce = "";
1458+
String options = "";
1459+
String bind = "";
1460+
int count = 0;
1461+
String labelCoalesce = "";
14531462

1454-
//This is too specific to the University of Bergen Library´s Ontology.
1455-
//In the future, you might want to let the default language be autmatically picked up.
1456-
String filter = "FILTER (langMatches(lang(?label), \"\") || langMatches(lang(?label), \"no\")) ";
1457-
1463+
//This is too specific to the University of Bergen Library´s Ontology.
1464+
//In the future, you might want to let the default language be autmatically picked up.
1465+
String filter = "FILTER (langMatches(lang(?label), \"\") || langMatches(lang(?label), \"no\")) ";
1466+
14581467
//Iterate over the list and build up the options.
14591468
for(String property : uriDescriptionList) {
14601469
String label = "?label" + count++;

0 commit comments

Comments
 (0)