proper fix to have the same substitutions as in RDFServiceTDB (#316)
This commit is contained in:
parent
6c95f5ab38
commit
b6d3b60530
1 changed files with 21 additions and 8 deletions
|
@ -36,6 +36,19 @@ public class RdfLiteralHash {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(RdfLiteralHash.class.getName());
|
private static final Log log = LogFactory.getLog(RdfLiteralHash.class.getName());
|
||||||
|
|
||||||
|
private static final String integerPattern =
|
||||||
|
"^http://www.w3.org/2001/XMLSchema#int$" + "|" +
|
||||||
|
"^http://www.w3.org/2001/XMLSchema#long$" + "|" +
|
||||||
|
"^http://www.w3.org/2001/XMLSchema#short$" + "|" +
|
||||||
|
"^http://www.w3.org/2001/XMLSchema#unsignedByte$" + "|" +
|
||||||
|
"^http://www.w3.org/2001/XMLSchema#unsignedShort$" + "|" +
|
||||||
|
"^http://www.w3.org/2001/XMLSchema#unsignedInt$" + "|" +
|
||||||
|
"^http://www.w3.org/2001/XMLSchema#unsignedLong$" + "|" +
|
||||||
|
"^http://www.w3.org/2001/XMLSchema#nonPositiveInteger$" + "|" +
|
||||||
|
"^http://www.w3.org/2001/XMLSchema#nonNegativeInteger$" + "|" +
|
||||||
|
"^http://www.w3.org/2001/XMLSchema#positiveInteger$" + "|" +
|
||||||
|
"^http://www.w3.org/2001/XMLSchema#negativeInteger$";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a hash based on individual, property, literal and (lang or datatype).
|
* Make a hash based on individual, property, literal and (lang or datatype).
|
||||||
*
|
*
|
||||||
|
@ -55,10 +68,11 @@ 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
|
// TDB has a bug: if given a literal of type xsd:nonNegativeInteger, it
|
||||||
//With Jena 3.16.0 all integer literals are stored as int
|
// stores a literal of type xsd:integer.
|
||||||
//TODO: remove workaround when bug is resolved
|
// Replace integer types the same way it is done in RDFServiceTDB
|
||||||
langOrDatatype = replaceIntegerWithInt(langOrDatatype);
|
// TODO: remove workaround when bug is resolved
|
||||||
|
langOrDatatype = replaceIntegers(langOrDatatype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,10 +82,9 @@ 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")) {
|
private static String replaceIntegers(String predicate) {
|
||||||
predicate = "http://www.w3.org/2001/XMLSchema#int";
|
predicate = predicate.replaceAll(integerPattern, "http://www.w3.org/2001/XMLSchema#integer");
|
||||||
}
|
|
||||||
return predicate;
|
return predicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue