Skip to content

Commit

Permalink
fix: check if object is iri before adding triple (#4227)
Browse files Browse the repository at this point in the history
  • Loading branch information
harmbrugge authored Sep 17, 2024
1 parent 325041c commit f767253
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,11 @@ private static void splitPropValAndAddToBuilder(
for (String propertyValue : (List<String>) map.get("propertyValue")) {
String[] propertyValueSplit = propertyValue.split(" ", -1);
checkPropValSplitLength(propertyValueSplit);
builder.add(catalogIriEnc, iri(propertyValueSplit[0]), iri(propertyValueSplit[1]));
if (propertyValueSplit[1].startsWith("http")) {
builder.add(catalogIriEnc, iri(propertyValueSplit[0]), iri(propertyValueSplit[1]));
} else {
builder.add(catalogIriEnc, iri(propertyValueSplit[0]), propertyValueSplit[1]);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ Optional in FDP specification (https://specs.fairdatapoint.org/)
for (String propertyValue : (List<String>) catalogFromJSON.get("propertyValue")) {
String[] propertyValueSplit = propertyValue.split(" ", -1);
nullCheckOnPropVal(propertyValueSplit);
builder.add(reqUrl, iri(propertyValueSplit[0]), iri(propertyValueSplit[1]));
if (propertyValueSplit[1].startsWith("http")) {
builder.add(reqUrl, iri(propertyValueSplit[0]), iri(propertyValueSplit[1]));
} else {
builder.add(reqUrl, iri(propertyValueSplit[0]), propertyValueSplit[1]);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ public String getResult() throws Exception {
throw new Exception(
"propertyValue should contain strings that each consist of 2 elements separated by 1 whitespace");
}
builder.add(reqUrl, iri(propertyValueSplit[0]), iri(propertyValueSplit[1]));
if (propertyValueSplit[1].startsWith("http")) {
builder.add(reqUrl, iri(propertyValueSplit[0]), iri(propertyValueSplit[1]));
} else {
builder.add(reqUrl, iri(propertyValueSplit[0]), propertyValueSplit[1]);
}
}
}
if (datasetFromJSON.get("spatialResolutionInMeters") != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ public FAIRDataPointDistribution(Request request, Database database) throws Exce
throw new Exception(
"propertyValue should contain strings that each consist of 2 elements separated by 1 whitespace");
}
builder.add(reqURL, iri(propertyValueSplit[0]), iri(propertyValueSplit[1]));
if (propertyValueSplit[1].startsWith("http")) {
builder.add(reqURL, iri(propertyValueSplit[0]), iri(propertyValueSplit[1]));
} else {
builder.add(reqURL, iri(propertyValueSplit[0]), propertyValueSplit[1]);
}
}
}
builder.add(
Expand Down

0 comments on commit f767253

Please sign in to comment.