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 73DE1200B8D for ; Thu, 8 Sep 2016 17:31:39 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7289F160ABD; Thu, 8 Sep 2016 15:31:39 +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 78C5C160AD7 for ; Thu, 8 Sep 2016 17:31:38 +0200 (CEST) Received: (qmail 45573 invoked by uid 500); 8 Sep 2016 15:31:37 -0000 Mailing-List: contact commits-help@commonsrdf.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commonsrdf.incubator.apache.org Delivered-To: mailing list commits@commonsrdf.incubator.apache.org Received: (qmail 45560 invoked by uid 99); 8 Sep 2016 15:31:37 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Sep 2016 15:31:37 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 44630C553B for ; Thu, 8 Sep 2016 15:31:37 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id rXsPl0rTdKHJ for ; Thu, 8 Sep 2016 15:31:34 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 3352960E63 for ; Thu, 8 Sep 2016 15:31:30 +0000 (UTC) Received: (qmail 43104 invoked by uid 99); 8 Sep 2016 15:31:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Sep 2016 15:31:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 482A0E1777; Thu, 8 Sep 2016 15:31:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: stain@apache.org To: commits@commonsrdf.incubator.apache.org Date: Thu, 08 Sep 2016 15:31:53 -0000 Message-Id: In-Reply-To: <3c718392e03740a1b7d60ec78c1dc9db@git.apache.org> References: <3c718392e03740a1b7d60ec78c1dc9db@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [25/50] incubator-commonsrdf git commit: TripleOrQuad -> TripleLike, GraphLike archived-at: Thu, 08 Sep 2016 15:31:39 -0000 TripleOrQuad -> TripleLike, GraphLike TripleLike is a generalized Triple (e.g. as seen in Jena), supporting any RDFTerm in any of the subject/predicate/object positions. This can be useful for parsers, and also serves as a common super-type for Quad and Triple. Equivalently, QuadLike extends TripleLike as a generalized Quad, supporting any RDFTerm as its graphName. Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/bc639bbd Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/bc639bbd Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/bc639bbd Branch: refs/heads/jsonld-java Commit: bc639bbd3b65ed6802dfdac14a53c9f96162bf32 Parents: 839a642 Author: Stian Soiland-Reyes Authored: Thu Jun 2 11:41:04 2016 +0100 Committer: Stian Soiland-Reyes Committed: Thu Jun 2 11:41:04 2016 +0100 ---------------------------------------------------------------------- .../java/org/apache/commons/rdf/api/Quad.java | 2 +- .../org/apache/commons/rdf/api/QuadLike.java | 63 +++++++++++++++++++ .../java/org/apache/commons/rdf/api/Triple.java | 2 +- .../org/apache/commons/rdf/api/TripleLike.java | 65 ++++++++++++++++++++ .../apache/commons/rdf/api/TripleOrQuad.java | 64 ------------------- 5 files changed, 130 insertions(+), 66 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/bc639bbd/api/src/main/java/org/apache/commons/rdf/api/Quad.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/Quad.java b/api/src/main/java/org/apache/commons/rdf/api/Quad.java index 7ccd0d1..fa9298e 100644 --- a/api/src/main/java/org/apache/commons/rdf/api/Quad.java +++ b/api/src/main/java/org/apache/commons/rdf/api/Quad.java @@ -32,7 +32,7 @@ import java.util.Optional; * 1.1: On Semantics of RDF Datasets * @see */ -public interface Quad extends TripleOrQuad { +public interface Quad extends QuadLike { /** * The graph name (graph label) of this quad, if present. http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/bc639bbd/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java b/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java new file mode 100644 index 0000000..a47e32b --- /dev/null +++ b/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java @@ -0,0 +1,63 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.rdf.api; + +import java.util.Optional; + +/** + * A generalised "quad-like" interface, extended by {@link Quad}. + *

+ * A QuadLike has at least a + * {@link #getSubject()}, {@link #getPredicate()} and + * {@link #getObject()}, and a {@link #getGraphName()}, + * but unlike a {@link Quad} does not have a + * formalised {@link Quad#equals(Object)} semantics, and allow + * generalised quads (e.g. a BlankNode as predicate). + *

+ * Implementations should specialise which RDFTerm + * subclasses they return for subject {@link S}, + * predicate {@link P}, object {@link O} and graph name {@link G}. + *

+ * @see Quad + */ +public interface QuadLike + extends TripleLike { + + + /** + * The graph name (graph label) of this quad, if present. + * + * If {@link Optional#isPresent()}, then the {@link Optional#get()} + * indicate the + * graph + * name of this Quad. If the graph name is not present (e.g. the value is + * {@link Optional#empty()}), it indicates that this Quad is in the + * default + * graph. + * + * @return If {@link Optional#isPresent()}, the graph name + * of this quad, otherwise. The graph name is typically an + * {@link IRI} or {@link BlankNode}. + * {@link Optional#empty()}, indicating the default graph. + * + * @see RDF- + * 1.1 Dataset + */ + Optional getGraphName(); + +} http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/bc639bbd/api/src/main/java/org/apache/commons/rdf/api/Triple.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/Triple.java b/api/src/main/java/org/apache/commons/rdf/api/Triple.java index 0725913..dcbb509 100644 --- a/api/src/main/java/org/apache/commons/rdf/api/Triple.java +++ b/api/src/main/java/org/apache/commons/rdf/api/Triple.java @@ -28,7 +28,7 @@ import java.util.Objects; * @see RDF-1.1 * Triple */ -public interface Triple extends TripleOrQuad { +public interface Triple extends TripleLike { /** * The subject of this triple, which may be either a {@link BlankNode} or an http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/bc639bbd/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java b/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java new file mode 100644 index 0000000..1ed75d0 --- /dev/null +++ b/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java @@ -0,0 +1,65 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.rdf.api; + +/** + * A generalised "triple-like" interface, extended by {@link Triple} and {@link Quad}. + *

+ * A TripleLike has at least a + * {@link #getSubject()}, {@link #getPredicate()} and + * {@link #getObject()}, but unlike a {@link Triple} does not have a + * formalised {@link Triple#equals(Object)} semantics, and allow + * generalised triples (e.g. a BlankNode as predicate). + *

+ * Implementations should specialise which RDFTerms subclasses + * they return for subject, predicate and object. + *

+ * @see Triple + * @see Quad + * @see QuadLike + * + */ +public interface TripleLike { + + /** + * The subject of this statement. + * + * @return The subject, typically an {@link IRI} or {@link BlankNode}. + * @see RDF-1.1 + * Triple subject + */ + S getSubject(); + + /** + * The predicate of this statement. + * + * @return The predicate, typically an {@link IRI}. + * @see RDF-1.1 + * Triple predicate + */ + P getPredicate(); + + /** + * The object of this statement. + * + * @return The object, typically an {@link IRI}, {@link BlankNode} or {@link Literal}. + * @see RDF-1.1 + * Triple object + */ + O getObject(); +} http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/bc639bbd/api/src/main/java/org/apache/commons/rdf/api/TripleOrQuad.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/TripleOrQuad.java b/api/src/main/java/org/apache/commons/rdf/api/TripleOrQuad.java deleted file mode 100644 index 6a86447..0000000 --- a/api/src/main/java/org/apache/commons/rdf/api/TripleOrQuad.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.rdf.api; - -/** - * Common "triple-like" interface for {@link Triple} and {@link Quad} - *

- * A TripleOrQuad has at least a - * {@link #getSubject()}, {@link #getPredicate()} and - * {@link #getObject()}, but unlike a {@link Triple} does not have a - * formalised {@link Triple#equals(Object)} semantics, and does not - * necessarily have a {@link Quad#getGraphName()} - *

- * Implementations of this interface SHOULD also implement {@link Triple} - * or {@link Quad}, but MUST NOT implement both interfaces. - */ -public interface TripleOrQuad { - - /** - * The subject of this triple/quad, which may be either a {@link BlankNode} or an - * {@link IRI}, which are represented in Commons RDF by the interface - * {@link BlankNodeOrIRI}. - * - * @return The subject {@link BlankNodeOrIRI} of this triple/quad. - * @see RDF-1.1 - * Triple subject - */ - BlankNodeOrIRI getSubject(); - - /** - * The predicate {@link IRI} of this triple/quad. - * - * @return The predicate {@link IRI} of this triple/quad. - * @see RDF-1.1 - * Triple predicate - */ - IRI getPredicate(); - - /** - * The object of this triple/quad, which may be either a {@link BlankNode}, an - * {@link IRI}, or a {@link Literal}, which are represented in Commons RDF - * by the interface {@link RDFTerm}. - * - * @return The object {@link RDFTerm} of this triple/quad. - * @see RDF-1.1 - * Triple object - */ - RDFTerm getObject(); -}