commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject incubator-commonsrdf git commit: Always use blocks.
Date Fri, 11 Nov 2016 22:41:17 GMT
Repository: incubator-commonsrdf
Updated Branches:
  refs/heads/master e36c67a6f -> 5274171f4


Always use blocks.

Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/5274171f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/5274171f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/5274171f

Branch: refs/heads/master
Commit: 5274171f4cafb2d87bb7ed244d0b52c4b0a78e7d
Parents: e36c67a
Author: Gary Gregory <ggregory@apache.org>
Authored: Fri Nov 11 14:41:15 2016 -0800
Committer: Gary Gregory <ggregory@apache.org>
Committed: Fri Nov 11 14:41:15 2016 -0800

----------------------------------------------------------------------
 .../org/apache/commons/rdf/jena/JenaRDF.java    | 36 +++++++++++++-------
 .../rdf/jena/impl/JenaBlankNodeImpl.java        |  9 +++--
 .../commons/rdf/jena/impl/JenaDatasetImpl.java  |  3 +-
 .../commons/rdf/jena/impl/JenaGraphImpl.java    |  3 +-
 .../commons/rdf/jena/impl/JenaIRIImpl.java      |  9 +++--
 .../commons/rdf/jena/impl/JenaLiteralImpl.java  | 12 ++++---
 .../commons/rdf/jena/impl/JenaQuadImpl.java     |  6 ++--
 .../commons/rdf/jena/impl/JenaTripleImpl.java   |  9 +++--
 8 files changed, 58 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5274171f/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDF.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDF.java b/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDF.java
index 577f93f..1bc4cbe 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDF.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDF.java
@@ -262,20 +262,24 @@ public final class JenaRDF implements RDF {
             // No need to convert, just wrap
             return ((JenaRDF) factory).asRDFTerm(node);
         }
-        if (node.isURI())
+        if (node.isURI()) {
             return factory.createIRI(node.getURI());
+        }
         if (node.isLiteral()) {
             String lang = node.getLiteralLanguage();
-            if (lang != null && !lang.isEmpty())
+            if (lang != null && !lang.isEmpty()) {
                 return factory.createLiteral(node.getLiteralLexicalForm(), lang);
-            if (node.getLiteralDatatype().equals(XSDDatatype.XSDstring))
+            }
+            if (node.getLiteralDatatype().equals(XSDDatatype.XSDstring)) {
                 return factory.createLiteral(node.getLiteralLexicalForm());
+            }
             IRI dt = factory.createIRI(node.getLiteralDatatype().getURI());
             return factory.createLiteral(node.getLiteralLexicalForm(), dt);
         }
-        if (node.isBlank())
+        if (node.isBlank()) {
             // The factory
             return factory.createBlankNode(node.getBlankNodeLabel());
+        }
         throw new ConversionException("Node is not a concrete RDF Term: " + node);
     }
 
@@ -638,8 +642,9 @@ public final class JenaRDF implements RDF {
      * @return Converted Jena {@link org.apache.jena.graph.Graph}
      */
     public org.apache.jena.graph.Graph asJenaGraph(Graph graph) {
-        if (graph instanceof JenaGraph)
+        if (graph instanceof JenaGraph) {
             return ((JenaGraph) graph).asJenaGraph();
+        }
         org.apache.jena.graph.Graph g = GraphFactory.createGraphMem();
         graph.stream().forEach(t -> g.add(asJenaTriple(t)));
         return g;
@@ -658,14 +663,16 @@ public final class JenaRDF implements RDF {
         if (term == null) {
             return null;
         }
-        if (term instanceof JenaRDFTerm)
+        if (term instanceof JenaRDFTerm) {
             // TODO: What if it's a JenaBlankNodeImpl with
             // a different salt? Do we need to rewrite the
             // jena blanknode identifier?
             return ((JenaRDFTerm) term).asJenaNode();
+        }
 
-        if (term instanceof IRI)
+        if (term instanceof IRI) {
             return NodeFactory.createURI(((IRI) term).getIRIString());
+        }
 
         if (term instanceof Literal) {
             Literal lit = (Literal) term;
@@ -693,8 +700,9 @@ public final class JenaRDF implements RDF {
      * @return Converted Jena {@link org.apache.jena.graph.Triple}
      */
     public org.apache.jena.graph.Triple asJenaTriple(Triple triple) {
-        if (triple instanceof JenaTriple)
+        if (triple instanceof JenaTriple) {
             return ((JenaTriple) triple).asJenaTriple();
+        }
         return org.apache.jena.graph.Triple.create(asJenaNode(triple.getSubject()), 
                 asJenaNode(triple.getPredicate()),
                 asJenaNode(triple.getObject()));
@@ -724,17 +732,21 @@ public final class JenaRDF implements RDF {
 
     // Some simple validations - full IRI parsing is not cheap.
     private void validateIRI(String iri) {
-        if (iri.contains(" "))
+        if (iri.contains(" ")) {
             throw new IllegalArgumentException();
-        if (iri.contains("<"))
+        }
+        if (iri.contains("<")) {
             throw new IllegalArgumentException();
-        if (iri.contains(">"))
+        }
+        if (iri.contains(">")) {
             throw new IllegalArgumentException();
+        }
     }
 
     private static void validateLang(String languageTag) {
-        if (languageTag.contains(" "))
+        if (languageTag.contains(" ")) {
             throw new IllegalArgumentException("Invalid language tag: " + languageTag);
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5274171f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaBlankNodeImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaBlankNodeImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaBlankNodeImpl.java
index 6e4d966..08a5880 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaBlankNodeImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaBlankNodeImpl.java
@@ -38,12 +38,15 @@ class JenaBlankNodeImpl extends AbstractJenaRDFTerm implements JenaBlankNode
{
 
     @Override
     public boolean equals(Object other) {
-        if (other == this)
+        if (other == this) {
             return true;
-        if (other == null)
+        }
+        if (other == null) {
             return false;
-        if (!(other instanceof BlankNode))
+        }
+        if (!(other instanceof BlankNode)) {
             return false;
+        }
         BlankNode bNode = (BlankNode) other;
         return uniqueReference().equals(bNode.uniqueReference());
     }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5274171f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaDatasetImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaDatasetImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaDatasetImpl.java
index e7602ca..1b4edb9 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaDatasetImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaDatasetImpl.java
@@ -98,8 +98,9 @@ class JenaDatasetImpl implements JenaDataset {
     }
 
     private Node toJenaPattern(RDFTerm term) {
-        if (term == null)
+        if (term == null) {
             return ANY;
+        }
         return factory.asJenaNode(term);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5274171f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGraphImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGraphImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGraphImpl.java
index 4647016..40b7280 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGraphImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGraphImpl.java
@@ -127,8 +127,9 @@ class JenaGraphImpl implements JenaGraph {
     }
 
     private Node toJenaAny(RDFTerm term) {
-        if (term == null)
+        if (term == null) {
             return Node.ANY;
+        }
         return factory.asJenaNode(term);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5274171f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaIRIImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaIRIImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaIRIImpl.java
index e09dbaf..69e1b97 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaIRIImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaIRIImpl.java
@@ -39,12 +39,15 @@ class JenaIRIImpl extends AbstractJenaRDFTerm implements JenaIRI {
 
     @Override
     public boolean equals(Object other) {
-        if (other == this)
+        if (other == this) {
             return true;
-        if (other == null)
+        }
+        if (other == null) {
             return false;
-        if (!(other instanceof IRI))
+        }
+        if (!(other instanceof IRI)) {
             return false;
+        }
         IRI iri = (IRI) other;
         return getIRIString().equals(iri.getIRIString());
     }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5274171f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaLiteralImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaLiteralImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaLiteralImpl.java
index d2afbe3..5891f8b 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaLiteralImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaLiteralImpl.java
@@ -40,12 +40,15 @@ class JenaLiteralImpl extends AbstractJenaRDFTerm implements JenaLiteral
{
 
     @Override
     public boolean equals(Object other) {
-        if (other == this)
+        if (other == this) {
             return true;
-        if (other == null)
+        }
+        if (other == null) {
             return false;
-        if (!(other instanceof Literal))
+        }
+        if (!(other instanceof Literal)) {
             return false;
+        }
         Literal literal = (Literal) other;
         return getLexicalForm().equals(literal.getLexicalForm()) && getLanguageTag().equals(literal.getLanguageTag())
                 && getDatatype().equals(literal.getDatatype());
@@ -59,8 +62,9 @@ class JenaLiteralImpl extends AbstractJenaRDFTerm implements JenaLiteral
{
     @Override
     public Optional<String> getLanguageTag() {
         String x = asJenaNode().getLiteralLanguage();
-        if (x == null || x.isEmpty())
+        if (x == null || x.isEmpty()) {
             return Optional.empty();
+        }
         return Optional.of(x);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5274171f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaQuadImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaQuadImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaQuadImpl.java
index e69200f..4da0133 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaQuadImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaQuadImpl.java
@@ -47,10 +47,12 @@ class JenaQuadImpl extends AbstractQuadLike<BlankNodeOrIRI, IRI, RDFTerm,
BlankN
 
     @Override
     public boolean equals(Object other) {
-        if (other == this)
+        if (other == this) {
             return true;
-        if (!(other instanceof Quad))
+        }
+        if (!(other instanceof Quad)) {
             return false;
+        }
         Quad quad = (Quad) other;
         return getGraphName().equals(quad.getGraphName()) && getSubject().equals(quad.getSubject())
                 && getPredicate().equals(quad.getPredicate()) && getObject().equals(quad.getObject());

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5274171f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaTripleImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaTripleImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaTripleImpl.java
index b9de91f..54f8a39 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaTripleImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaTripleImpl.java
@@ -44,12 +44,15 @@ class JenaTripleImpl extends AbstractQuadLike<BlankNodeOrIRI, IRI,
RDFTerm, RDFT
 
     @Override
     public boolean equals(Object other) {
-        if (other == this)
+        if (other == this) {
             return true;
-        if (other == null)
+        }
+        if (other == null) {
             return false;
-        if (!(other instanceof Triple))
+        }
+        if (!(other instanceof Triple)) {
             return false;
+        }
         Triple triple = (Triple) other;
         return getSubject().equals(triple.getSubject()) && getPredicate().equals(triple.getPredicate())
                 && getObject().equals(triple.getObject());


Mime
View raw message