Skip to content

Commit

Permalink
Merge pull request #638 from EBISPOT/nesting-issue
Browse files Browse the repository at this point in the history
Changed check for leaf node to just check for any builtin XML data type.
  • Loading branch information
henrietteharmse authored Apr 3, 2024
2 parents fa543bf + 817ab85 commit 54fbdbb
Showing 1 changed file with 3 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -476,30 +476,8 @@ public void writePropertyValue(JsonWriter writer, PropertyValue value, Set<Strin

}

private final static Set<String> XMLPrimitiveDataTypes = new HashSet<>(Arrays.asList(
"http://www.w3.org/2001/XMLSchema#string",
"http://www.w3.org/2001/XMLSchema#boolean",
"http://www.w3.org/2001/XMLSchema#decimal",
"http://www.w3.org/2001/XMLSchema#float",
"http://www.w3.org/2001/XMLSchema#double",
"http://www.w3.org/2001/XMLSchema#duration",
"http://www.w3.org/2001/XMLSchema#dateTime",
"http://www.w3.org/2001/XMLSchema#time",
"http://www.w3.org/2001/XMLSchema#date",
"http://www.w3.org/2001/XMLSchema#gYearMonth",
"http://www.w3.org/2001/XMLSchema#gYear",
"http://www.w3.org/2001/XMLSchema#gMonthDay",
"http://www.w3.org/2001/XMLSchema#gDay",
"http://www.w3.org/2001/XMLSchema#gMonth",
"http://www.w3.org/2001/XMLSchema#hexBinary",
"http://www.w3.org/2001/XMLSchema#base64Binary",
"http://www.w3.org/2001/XMLSchema#anyURI",
"http://www.w3.org/2001/XMLSchema#QName",
"http://www.w3.org/2001/XMLSchema#NOTATION"
));

private boolean isXMLPrimitiveDatatype(String uri) {
return XMLPrimitiveDataTypes.contains(uri);
private boolean isXMLBuiltinDatatype(String uri) {
return uri.startsWith("http://www.w3.org/2001/XMLSchema#");
}
public void writeValue(JsonWriter writer, PropertyValue value) throws IOException {
assert (value.axioms == null);
Expand Down Expand Up @@ -538,7 +516,7 @@ public void writeValue(JsonWriter writer, PropertyValue value) throws IOExceptio
case URI:
String uri = ((PropertyValueURI) value).getUri();
OntologyNode uriNode = nodes.get(uri);
if(uriNode != null && !isXMLPrimitiveDatatype(uri) && uriNode.types.contains(OntologyNode.NodeType.DATATYPE)) {
if(uriNode != null && !isXMLBuiltinDatatype(uri) && uriNode.types.contains(OntologyNode.NodeType.DATATYPE)) {
// special case for rdfs:Datatype; nest it as with a bnode instead of referencing
writeNode(writer, uriNode, Set.of("datatype"));
} else {
Expand Down

0 comments on commit 54fbdbb

Please sign in to comment.