Updated Branches: refs/heads/develop 756b6a82b -> be14d5985
fix for MARMOTTA-401 (better hashcodes for literals) Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/be14d598 Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/be14d598 Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/be14d598 Branch: refs/heads/develop Commit: be14d59851313fcad448675902346d7e1b2cfba4 Parents: 756b6a8 Author: Sebastian Schaffert <[email protected]> Authored: Tue Dec 10 21:00:16 2013 +0100 Committer: Sebastian Schaffert <[email protected]> Committed: Tue Dec 10 21:00:16 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/be14d598/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 c2f7e85..aa5cd56 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 java.util.Locale; * 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; @@ -130,7 +130,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)) { @@ -163,7 +163,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; @@ -174,9 +174,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; }
