Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 141F8200C39 for ; Thu, 9 Feb 2017 02:59:17 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 13177160B6A; Thu, 9 Feb 2017 01:59:17 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DB6D5160B6F for ; Thu, 9 Feb 2017 02:59:15 +0100 (CET) Received: (qmail 93569 invoked by uid 500); 9 Feb 2017 01:59:15 -0000 Mailing-List: contact notifications-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list notifications@commons.apache.org Received: (qmail 93559 invoked by uid 99); 9 Feb 2017 01:59:15 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Feb 2017 01:59:15 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id C09523A3B1B for ; Thu, 9 Feb 2017 01:59:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1006438 [7/23] - in /websites/production/commons/content/proper/commons-rdf: ./ apidocs/ apidocs/org/apache/commons/rdf/api/ apidocs/org/apache/commons/rdf/api/class-use/ apidocs/org/apache/commons/rdf/experimental/ apidocs/org/apache/comm... Date: Thu, 09 Feb 2017 01:59:10 -0000 To: notifications@commons.apache.org From: stain@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170209015913.C09523A3B1B@svn01-us-west.apache.org> archived-at: Thu, 09 Feb 2017 01:59:17 -0000 Modified: websites/production/commons/content/proper/commons-rdf/apidocs/src-html/org/apache/commons/rdf/jena/impl/InternalJenaFactory.html ============================================================================== --- websites/production/commons/content/proper/commons-rdf/apidocs/src-html/org/apache/commons/rdf/jena/impl/InternalJenaFactory.html (original) +++ websites/production/commons/content/proper/commons-rdf/apidocs/src-html/org/apache/commons/rdf/jena/impl/InternalJenaFactory.html Thu Feb 9 01:59:06 2017 @@ -167,7 +167,7 @@ 159 } 160 throw new ConversionException("Unrecognized node type: " + node); 161 } -162 +162 163 public JenaTriple createTriple(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { 164 return new JenaTripleImpl(subject, predicate, object); 165 } Modified: websites/production/commons/content/proper/commons-rdf/apidocs/src-html/org/apache/commons/rdf/jsonldjava/JsonLdGraphLike.html ============================================================================== --- websites/production/commons/content/proper/commons-rdf/apidocs/src-html/org/apache/commons/rdf/jsonldjava/JsonLdGraphLike.html (original) +++ websites/production/commons/content/proper/commons-rdf/apidocs/src-html/org/apache/commons/rdf/jsonldjava/JsonLdGraphLike.html Thu Feb 9 01:59:06 2017 @@ -212,22 +212,36 @@ 204 if (predicateNode.isPresent() && predicateNode.get().compareTo(q.getPredicate()) != 0) { 205 return false; 206 } -207 if (objectNode.isPresent() && objectNode.get().compareTo(q.getObject()) != 0) { -208 return false; -209 } -210 return true; -211 }; -212 } -213 -214 // NOTE: This is made public in JsonLdDataset and is used by the other -215 // remove methods. -216 void remove(final Optional<BlankNodeOrIRI> graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { -217 // remove the quads which match our filter (which could have nulls as -218 // wildcards) -219 filteredGraphs(graphName).forEach(t -> t.removeIf(quadFilter(subject, predicate, object))); -220 } -221 -222} +207 if (objectNode.isPresent()) { +208 if (object instanceof Literal && q.getObject().isLiteral()) { +209 // Special handling for COMMONSRDF-56, COMMONSRDF-51: +210 // Less efficient wrapper to a Commons RDF Literal so +211 // we can use our RDF 1.1-compliant .equals() +212 RDFTerm otherObj = factory.asRDFTerm(q.getObject()); +213 if (! (object.equals(otherObj))) { +214 return false; +215 } +216 } else { +217 // JSONLD-Java's .compareTo can handle IRI, BlankNode and type-mismatch +218 if (objectNode.get().compareTo(q.getObject()) != 0) { +219 return false; +220 } +221 } +222 } +223 // All patterns checked, must be good! +224 return true; +225 }; +226 } +227 +228 // NOTE: This is made public in JsonLdDataset and is used by the other +229 // remove methods. +230 void remove(final Optional<BlankNodeOrIRI> graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { +231 // remove the quads which match our filter (which could have nulls as +232 // wildcards) +233 filteredGraphs(graphName).forEach(t -> t.removeIf(quadFilter(subject, predicate, object))); +234 } +235 +236} Modified: websites/production/commons/content/proper/commons-rdf/apidocs/src-html/org/apache/commons/rdf/jsonldjava/JsonLdLiteral.html ============================================================================== --- websites/production/commons/content/proper/commons-rdf/apidocs/src-html/org/apache/commons/rdf/jsonldjava/JsonLdLiteral.html (original) +++ websites/production/commons/content/proper/commons-rdf/apidocs/src-html/org/apache/commons/rdf/jsonldjava/JsonLdLiteral.html Thu Feb 9 01:59:06 2017 @@ -25,85 +25,88 @@ 017 */ 018package org.apache.commons.rdf.jsonldjava; 019 -020import java.util.Objects; -021import java.util.Optional; -022 -023import org.apache.commons.rdf.api.IRI; -024import org.apache.commons.rdf.api.Literal; -025import org.apache.commons.rdf.simple.Types; -026 -027import com.github.jsonldjava.core.RDFDataset.Node; -028 -029public interface JsonLdLiteral extends JsonLdTerm, Literal { -030} -031 -032class JsonLdLiteralImpl extends JsonLdTermImpl implements JsonLdLiteral { -033 -034 JsonLdLiteralImpl(final Node node) { -035 super(node); -036 if (!node.isLiteral()) { -037 throw new IllegalArgumentException("Node is not a Literal:" + node); -038 } -039 } -040 -041 @Override -042 public String ntriplesString() { -043 final StringBuilder sb = new StringBuilder(); -044 sb.append('"'); -045 // Escape special characters -046 sb.append(getLexicalForm().replace("\\", "\\\\"). // escaped to \\ -047 replace("\"", "\\\""). // escaped to \" -048 replace("\r", "\\r"). // escaped to \r -049 replace("\n", "\\n")); // escaped to \n -050 sb.append('"'); -051 -052 if (getLanguageTag().isPresent()) { -053 sb.append("@"); -054 sb.append(getLanguageTag().get()); -055 } else if (!getDatatype().equals(Types.XSD_STRING)) { -056 sb.append("^^"); -057 sb.append(getDatatype().ntriplesString()); -058 } -059 return sb.toString(); -060 } -061 -062 @Override -063 public String getLexicalForm() { -064 return node.getValue(); +020import java.util.Locale; +021import java.util.Objects; +022import java.util.Optional; +023 +024import org.apache.commons.rdf.api.IRI; +025import org.apache.commons.rdf.api.Literal; +026import org.apache.commons.rdf.simple.Types; +027 +028import com.github.jsonldjava.core.RDFDataset.Node; +029 +030public interface JsonLdLiteral extends JsonLdTerm, Literal { +031} +032 +033class JsonLdLiteralImpl extends JsonLdTermImpl implements JsonLdLiteral { +034 +035 JsonLdLiteralImpl(final Node node) { +036 super(node); +037 if (!node.isLiteral()) { +038 throw new IllegalArgumentException("Node is not a Literal:" + node); +039 } +040 } +041 +042 private static String lowerCase(String langTag) { +043 return langTag.toLowerCase(Locale.ROOT); +044 } +045 +046 @Override +047 public String ntriplesString() { +048 final StringBuilder sb = new StringBuilder(); +049 sb.append('"'); +050 // Escape special characters +051 sb.append(getLexicalForm().replace("\\", "\\\\"). // escaped to \\ +052 replace("\"", "\\\""). // escaped to \" +053 replace("\r", "\\r"). // escaped to \r +054 replace("\n", "\\n")); // escaped to \n +055 sb.append('"'); +056 +057 if (getLanguageTag().isPresent()) { +058 sb.append("@"); +059 sb.append(getLanguageTag().get()); +060 } else if (!getDatatype().equals(Types.XSD_STRING)) { +061 sb.append("^^"); +062 sb.append(getDatatype().ntriplesString()); +063 } +064 return sb.toString(); 065 } 066 067 @Override -068 public IRI getDatatype() { -069 return new JsonLdIRIImpl(node.getDatatype()); +068 public String getLexicalForm() { +069 return node.getValue(); 070 } 071 072 @Override -073 public Optional<String> getLanguageTag() { -074 return Optional.ofNullable(node.getLanguage()); +073 public IRI getDatatype() { +074 return new JsonLdIRIImpl(node.getDatatype()); 075 } 076 077 @Override -078 public int hashCode() { -079 // Should be the same as -080 // Objects.hash(getLexicalForm(), getDatatype(), getLanguageTag()); -081 return Objects.hash(node.getValue(), node.getDatatype(), node.getLanguage()); -082 } -083 -084 @Override -085 public boolean equals(final Object obj) { -086 if (obj instanceof JsonLdLiteral) { -087 final JsonLdLiteral other = (JsonLdLiteral) obj; -088 return asJsonLdNode().compareTo(other.asJsonLdNode()) == 0; -089 } -090 if (obj instanceof Literal) { -091 final Literal other = (Literal) obj; -092 return getLexicalForm().equals(other.getLexicalForm()) && getDatatype().equals(other.getDatatype()) -093 && getLanguageTag().equals(other.getLanguageTag()); -094 } -095 return false; -096 -097 } -098} +078 public Optional<String> getLanguageTag() { +079 return Optional.ofNullable(node.getLanguage()); +080 } +081 +082 @Override +083 public int hashCode() { +084 return Objects.hash(node.getValue(), node.getDatatype(), +085 getLanguageTag().map(JsonLdLiteralImpl::lowerCase)); +086 } +087 +088 @Override +089 public boolean equals(final Object obj) { +090 // COMMONSRDF-56: Do **not** use +091 // asJsonLdNode().compareTo(other.asJsonLdNode()) +092 if (obj instanceof Literal) { +093 final Literal other = (Literal) obj; +094 return getLexicalForm().equals(other.getLexicalForm()) +095 && getDatatype().equals(other.getDatatype()) +096 && getLanguageTag().map(JsonLdLiteralImpl::lowerCase) +097 .equals(other.getLanguageTag().map(JsonLdLiteralImpl::lowerCase)); +098 } +099 return false; +100 } +101} Modified: websites/production/commons/content/proper/commons-rdf/apidocs/src-html/org/apache/commons/rdf/jsonldjava/JsonLdQuadLike.html ============================================================================== --- websites/production/commons/content/proper/commons-rdf/apidocs/src-html/org/apache/commons/rdf/jsonldjava/JsonLdQuadLike.html (original) +++ websites/production/commons/content/proper/commons-rdf/apidocs/src-html/org/apache/commons/rdf/jsonldjava/JsonLdQuadLike.html Thu Feb 9 01:59:06 2017 @@ -80,7 +80,12 @@ 072 public Quad asJsonLdQuad() { 073 return quad; 074 } -075} +075 +076 @Override +077 public String toString() { +078 return quad.toString(); +079 } +080}