fix: workaround for jena bug. Treat integer and int equally while creating hash (#314)

This commit is contained in:
Georgy Litvinov 2022-07-06 13:13:28 +02:00 committed by GitHub
parent ceebd3e422
commit acd2bf6a59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,6 +55,10 @@ public class RdfLiteralHash {
}else{ }else{
if( stmt.getDatatypeURI() != null && stmt.getDatatypeURI().trim().length() > 0){ if( stmt.getDatatypeURI() != null && stmt.getDatatypeURI().trim().length() > 0){
langOrDatatype = stmt.getDatatypeURI(); langOrDatatype = stmt.getDatatypeURI();
//Treat integer data type the same as int
//With Jena 3.16.0 all integer literals are stored as int
//TODO: remove workaround when bug is resolved
langOrDatatype = replaceIntegerWithInt(langOrDatatype);
} }
} }
@ -64,6 +68,12 @@ public class RdfLiteralHash {
return hashMe.hashCode(); return hashMe.hashCode();
} }
private static String replaceIntegerWithInt(String predicate) {
if( predicate.equals("http://www.w3.org/2001/XMLSchema#integer")) {
predicate = "http://www.w3.org/2001/XMLSchema#int";
}
return predicate;
}
/** /**
* @param stmt Data statement * @param stmt Data statement