You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2013/12/11 11:47:27 UTC
[2/2] git commit: backport for MARMOTTA-401 (better hashcodes for
literals) (cherry picked from commit
be14d59851313fcad448675902346d7e1b2cfba4)
backport for MARMOTTA-401 (better hashcodes for literals)
(cherry picked from commit be14d59851313fcad448675902346d7e1b2cfba4)
Signed-off-by: Jakob Frank <ja...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/bfaf09d3
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/bfaf09d3
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/bfaf09d3
Branch: refs/heads/maintenance-3.1.x
Commit: bfaf09d343fc9c49ca18a3ddcb9626b3db4e708e
Parents: 7338468
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Tue Dec 10 21:00:16 2013 +0100
Committer: Jakob Frank <ja...@apache.org>
Committed: Wed Dec 11 11:30:27 2013 +0100
----------------------------------------------------------------------
.../apache/marmotta/kiwi/model/rdf/KiWiLiteral.java | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/bfaf09d3/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiLiteral.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiLiteral.java b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiLiteral.java
index 5371eef..92bd4c8 100644
--- a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiLiteral.java
+++ b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiLiteral.java
@@ -34,15 +34,15 @@ import org.openrdf.model.datatypes.XMLDatatypeUtil;
* parametrized with the Java type corresponding to the literal content they store.
* The method getType() returns the KiWiResource representing the RDF type of this
* literal. This information can e.g. be used to provide appropriate user interfaces.
- *
+ *
* A factory class should be provided that maps between RDF types and Java classes.
- *
+ *
* @author Sebastian Schaffert
*/
public abstract class KiWiLiteral extends KiWiNode implements Literal {
/**
- *
+ *
*/
private static final long serialVersionUID = 1772323725671607249L;
@@ -119,7 +119,7 @@ public abstract class KiWiLiteral extends KiWiNode implements Literal {
result.append("@").append(locale.getLanguage());
}
if (type != null) {
- result.append("^^");
+ result.append("^^");
if (type.stringValue().startsWith(Namespaces.NS_XSD)) {
result.append(getType().stringValue().replace(Namespaces.NS_XSD, "xsd:"));
} else if (type.stringValue().startsWith(Namespaces.NS_RDF)) {
@@ -152,7 +152,7 @@ public abstract class KiWiLiteral extends KiWiNode implements Literal {
// getDatatype should never be null, this is only for legacy support
if(this.getDatatype()==null && that.getDatatype()!=null) return false;
-
+
if(this.getDatatype() != null && !this.getDatatype().equals(that.getDatatype())) return false;
return true;
@@ -163,9 +163,10 @@ public abstract class KiWiLiteral extends KiWiNode implements Literal {
@Override
public int hashCode() {
- int result = locale != null ? locale.hashCode() : 0;
+ int result = this.getClass().hashCode();
+ result = 31 * result + (locale != null ? locale.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
- result = 32 * result + this.getLabel().hashCode();
+ result = 31 * result + this.getLabel().hashCode();
return result;
}