You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2016/10/06 13:29:40 UTC

[1/5] jena git commit: Fix for javadoc

Repository: jena
Updated Branches:
  refs/heads/master 22b2efbde -> 158b64dd0


Fix for javadoc

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/e5a8586e
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/e5a8586e
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/e5a8586e

Branch: refs/heads/master
Commit: e5a8586e6b2a9fba5a771b02b388126c6cfdf005
Parents: 22b2efb
Author: Andy Seaborne <an...@apache.org>
Authored: Mon Oct 3 17:05:54 2016 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Mon Oct 3 17:05:54 2016 +0100

----------------------------------------------------------------------
 jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMap.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/e5a8586e/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMap.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMap.java b/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMap.java
index a365dd1..1fd73bb 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMap.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMap.java
@@ -73,7 +73,7 @@ public interface PrefixMap {
     public abstract Map<String, String> getMappingCopyStr();
 
     /**
-     * Apply a {@link BiConsumer}{@code<String, IRI>} to each entry in the Prefixmap.
+     * Apply a {@link BiConsumer}{@code <String, IRI>} to each entry in the Prefixmap.
      */
     public abstract void forEach(BiConsumer<String, IRI> action) ;
 


[5/5] jena git commit: Fix javadoc warnings

Posted by an...@apache.org.
Fix javadoc warnings


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/158b64dd
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/158b64dd
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/158b64dd

Branch: refs/heads/master
Commit: 158b64dd0041b16efb53b12da4ce810980441c66
Parents: 15aa623
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Oct 6 14:29:21 2016 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Oct 6 14:29:21 2016 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/jena/rdf/model/Resource.java    | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/158b64dd/jena-core/src/main/java/org/apache/jena/rdf/model/Resource.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/rdf/model/Resource.java b/jena-core/src/main/java/org/apache/jena/rdf/model/Resource.java
index 69485cf..f03ed94 100644
--- a/jena-core/src/main/java/org/apache/jena/rdf/model/Resource.java
+++ b/jena-core/src/main/java/org/apache/jena/rdf/model/Resource.java
@@ -136,7 +136,7 @@ public interface Resource extends RDFNode {
     * be returned.  If no such statements are found, an exception is thrown.</p>
     * @param p The property sought.
     * @param lang The language of the statement with the property sought.
-    * @return some (this, p, ?O) statement if one exists
+    * @return some (this, p@lang, ?O) statement if one exists
     * @throws PropertyNotFoundException if no such statement found
     */
     public Statement getRequiredProperty( Property p, String lang );
@@ -155,10 +155,8 @@ public interface Resource extends RDFNode {
      * returned. If no such statements exist, null is returned - in this is differs
      * from getRequiredProperty.
      * @param p The property sought.
-     * @param o The value of the property sought.
-     * @param l The language of the property sought.
-     * @return true if and only if this resource has property p with
-     * value o.
+     * @param lang The language of the property sought.
+     * @return some (this, p@lang, ?O) statement if one exists
      */
     public Statement getProperty( Property p, String lang );
 


[2/5] jena git commit: Add string versions of Chars.

Posted by an...@apache.org.
Add string versions of Chars.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/0bef6f8f
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/0bef6f8f
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/0bef6f8f

Branch: refs/heads/master
Commit: 0bef6f8f1a290d66e7e896143bf67c97098d2762
Parents: e5a8586
Author: Andy Seaborne <an...@apache.org>
Authored: Mon Oct 3 17:06:09 2016 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Mon Oct 3 17:06:09 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/jena/atlas/lib/Chars.java   | 34 ++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/0bef6f8f/jena-base/src/main/java/org/apache/jena/atlas/lib/Chars.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/Chars.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/Chars.java
index da84832..9426d6b 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/Chars.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/Chars.java
@@ -257,5 +257,39 @@ public class Chars
     public static final byte B_RSLASH        = '\\' ;
     public static final byte B_PERCENT       = '%' ;
     
+    // String versions - a few compound "chars" as well.
+    public static final String S_LBRACKET     = "[" ;
+    public static final String S_RBRACKET     = "]" ;
+    
+    public static final String S_LBRACE       = "{" ;
+    public static final String S_RBRACE       = "}" ;
+
+    public static final String S_LPAREN       = "(" ;
+    public static final String S_RPAREN       = ")" ;
+
+    public static final String S_LT           = "<" ;
+    public static final String S_LE           = "<=" ;
+    public static final String S_GT           = ">" ;
+    public static final String S_GE           = ">=" ;
+    public static final String S_UNDERSCORE   = "_" ;
+
+    public static final String S_QUOTE1       = "'" ;
+    public static final String S_QUOTE2       = "\"" ;
 
+    public static final String S_EQUALS       = "=" ;
+    public static final String S_STAR         = "*" ;
+    public static final String S_DOT          = "." ;
+    public static final String S_COMMA        = "," ;
+    public static final String S_SEMICOLON    = ";" ;
+    public static final String S_COLON        = ":" ;
+    public static final String S_AMPHERSAND   = "&" ;
+    public static final String S_AT           = "@" ;
+    public static final String S_QMARK        = "?" ;
+    public static final String S_HASH         = "#" ;
+    public static final String S_PLUS         = "+" ;
+    public static final String S_MINUS        = "-" ;
+    public static final String S_DASH         = "-" ; // Alt name
+    public static final String S_SLASH        = "/" ;
+    public static final String S_RSLASH       = "\\" ;
+    public static final String S_PERCENT      = "%" ;
 }


[3/5] jena git commit: Proposal to add 2 new getters in the Resource interface and their respective tests.

Posted by an...@apache.org.
Proposal to add 2 new getters in the Resource interface and their
respective tests.


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/d761b735
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/d761b735
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/d761b735

Branch: refs/heads/master
Commit: d761b735d9de4729ced6d16cd9676044b012fd13
Parents: fbb53ef
Author: Ramiro Pereira de Magalh�es <ra...@gmail.com>
Authored: Thu Sep 29 15:48:39 2016 -0300
Committer: Ramiro Pereira de Magalh�es <ra...@gmail.com>
Committed: Mon Oct 3 18:03:28 2016 -0300

----------------------------------------------------------------------
 .../org/apache/jena/rdf/model/Resource.java     | 25 +++++++++++
 .../jena/rdf/model/impl/ResourceImpl.java       | 18 +++++++-
 .../jena/rdf/model/test/AbstractTestModel.java  | 47 +++++++++++++++++++-
 3 files changed, 87 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/d761b735/jena-core/src/main/java/org/apache/jena/rdf/model/Resource.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/rdf/model/Resource.java b/jena-core/src/main/java/org/apache/jena/rdf/model/Resource.java
index 497ca24..69485cf 100644
--- a/jena-core/src/main/java/org/apache/jena/rdf/model/Resource.java
+++ b/jena-core/src/main/java/org/apache/jena/rdf/model/Resource.java
@@ -128,6 +128,19 @@ public interface Resource extends RDFNode {
      */
     public Statement getRequiredProperty( Property p );
 
+    /** Get a property value of this resource in a specified language.
+    *
+    * <p>The model associated with the resource instance is searched for statements
+    * whose subject is this resource and whose predicate is p.  If such a statement
+    * is found, it is returned.  If several such statements are found, any one may
+    * be returned.  If no such statements are found, an exception is thrown.</p>
+    * @param p The property sought.
+    * @param lang The language of the statement with the property sought.
+    * @return some (this, p, ?O) statement if one exists
+    * @throws PropertyNotFoundException if no such statement found
+    */
+    public Statement getRequiredProperty( Property p, String lang );
+
     /**
      Answer some statement (this, p, O) in the associated model. If there are several
      such statements, any one of them may be returned. If no such statements exist,
@@ -137,6 +150,18 @@ public interface Resource extends RDFNode {
      */
     public Statement getProperty( Property p );
 
+    /** Answer some statement (this, p, O), in language <code>lang</code>, in the
+     * associated model. If there are several such statements, any one of them may be
+     * returned. If no such statements exist, null is returned - in this is differs
+     * from getRequiredProperty.
+     * @param p The property sought.
+     * @param o The value of the property sought.
+     * @param l The language of the property sought.
+     * @return true if and only if this resource has property p with
+     * value o.
+     */
+    public Statement getProperty( Property p, String lang );
+
     /** List all the values of the property p.
      *
      * <p>Returns an iterator over all the statements in the associated model whose

http://git-wip-us.apache.org/repos/asf/jena/blob/d761b735/jena-core/src/main/java/org/apache/jena/rdf/model/impl/ResourceImpl.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/rdf/model/impl/ResourceImpl.java b/jena-core/src/main/java/org/apache/jena/rdf/model/impl/ResourceImpl.java
index 3d36065..55a7672 100644
--- a/jena-core/src/main/java/org/apache/jena/rdf/model/impl/ResourceImpl.java
+++ b/jena-core/src/main/java/org/apache/jena/rdf/model/impl/ResourceImpl.java
@@ -25,6 +25,7 @@ import org.apache.jena.enhanced.Implementation ;
 import org.apache.jena.graph.Node ;
 import org.apache.jena.graph.NodeFactory ;
 import org.apache.jena.rdf.model.* ;
+import org.apache.jena.shared.PropertyNotFoundException;
 
 /** An implementation of Resource.
  */
@@ -170,12 +171,27 @@ public class ResourceImpl extends EnhNode implements Resource {
     @Override
     public Statement getRequiredProperty(Property p) 
     	{ return mustHaveModel().getRequiredProperty( this, p ); }
-        
+
+    @Override
+    public Statement getRequiredProperty( final Property p, final String lang )
+        {
+        final StmtIterator it = mustHaveModel().listStatements(this, p, null, lang);
+        if (!it.hasNext()) throw new PropertyNotFoundException( p );
+        return it.next();
+        }
+
     @Override
     public Statement getProperty( Property p )
         { return mustHaveModel().getProperty( this, p ); }
 
     @Override
+    public Statement getProperty( final Property p, final String lang )
+        {
+        final StmtIterator it = mustHaveModel().listStatements(this, p, null, lang);
+        return it.hasNext() ? it.next() : null;
+        }
+
+    @Override
     public StmtIterator listProperties(Property p) 
 		{ return mustHaveModel().listStatements( this, p, (RDFNode) null ); }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/d761b735/jena-core/src/test/java/org/apache/jena/rdf/model/test/AbstractTestModel.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/rdf/model/test/AbstractTestModel.java b/jena-core/src/test/java/org/apache/jena/rdf/model/test/AbstractTestModel.java
index 451f205..6eaaffc 100644
--- a/jena-core/src/test/java/org/apache/jena/rdf/model/test/AbstractTestModel.java
+++ b/jena-core/src/test/java/org/apache/jena/rdf/model/test/AbstractTestModel.java
@@ -21,8 +21,16 @@ package org.apache.jena.rdf.model.test;
 import org.apache.jena.graph.Node ;
 import org.apache.jena.graph.Triple ;
 import org.apache.jena.graph.test.NodeCreateUtils ;
-import org.apache.jena.rdf.model.* ;
+import org.apache.jena.rdf.model.AnonId;
+import org.apache.jena.rdf.model.Literal;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.ModelFactory;
+import org.apache.jena.rdf.model.Property;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Resource;
+import org.apache.jena.rdf.model.Statement;
 import org.apache.jena.rdf.model.impl.ModelCom ;
+import org.apache.jena.shared.PropertyNotFoundException;
 
 public abstract class AbstractTestModel extends ModelTestBase
     {
@@ -108,7 +116,42 @@ public abstract class AbstractTestModel extends ModelTestBase
         assertTrue( ob.equals( resource( model, "a" ) ) || ob.equals( resource( model, "b" ) ) );
         assertNull( x.getProperty( property( model, "noSuchPropertyHere" ) ) );
         }
-    
+
+    /**
+     * Tests {@link Resource#getProperty(Property, String)} and
+     * {@link Resource#getRequiredProperty(Property, String)}.
+     */
+    public void testGetPropertyWithLanguage()
+        {
+        model.createStatement(ModelTestBase.resource(model, "x"), ModelTestBase.property(model, "P"), "a", "pt");
+        model.createStatement(ModelTestBase.resource(model, "x"), ModelTestBase.property(model, "P"), "b", "en");
+        model.createStatement(ModelTestBase.resource(model, "x"), ModelTestBase.property(model, "P"), "c", "es");
+        model.createStatement(ModelTestBase.resource(model, "x"), ModelTestBase.property(model, "R"), "d", "fr");
+        model.createStatement(ModelTestBase.resource(model, "x"), ModelTestBase.property(model, "R"), "e", "de");
+
+        {//Tests {@link Resource#getProperty(Property, String)}
+        final Resource x = resource( model, "x" );
+        assertEquals("a", x.getProperty( property( model, "P" ), "pt") );
+        assertEquals("b", x.getProperty( property( model, "P" ), "en") );
+        assertNull(x.getProperty( property( model, "P" ), "ja") );
+        final Literal l = x.getProperty( property(model, "R") ).getLiteral();
+        assertTrue( "d".equals( l.getString() ) || "e".equals( l.getString() ) );
+        }
+
+        {//Tests {@link Resource#getRequiredProperty(Property, String)}
+        final Resource x = resource( model, "x" );
+        assertEquals("a", x.getRequiredProperty( property( model, "P" ), "pt") );
+        assertEquals("b", x.getRequiredProperty( property( model, "P" ), "en") );
+        try {
+            x.getRequiredProperty( property( model, "P" ), "ja");
+            fail("Must thrown PropertyNotFoundException.");
+        } catch (PropertyNotFoundException e) {}
+        final Literal l = x.getRequiredProperty( property(model, "R") ).getLiteral();
+        assertTrue( "d".equals( l.getString() ) || "e".equals( l.getString() ) );
+        assertTrue("de".equals( l.getLanguage() ) || "fr".equals( l.getLanguage() ) );
+        }
+        }
+
     public void testToStatement()
         {
         Triple t = triple( "a P b" );


[4/5] jena git commit: JENA-1238: Merge commit 'refs/pull/172/head' of github.com:apache/jena

Posted by an...@apache.org.
JENA-1238: Merge commit 'refs/pull/172/head' of github.com:apache/jena

This closes #172.


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/15aa623f
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/15aa623f
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/15aa623f

Branch: refs/heads/master
Commit: 15aa623f9e3a94140f1d2aa8e6b2dfc73831e829
Parents: 0bef6f8 d761b73
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Oct 6 14:22:36 2016 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Oct 6 14:22:36 2016 +0100

----------------------------------------------------------------------
 .../org/apache/jena/rdf/model/Resource.java     | 25 +++++++++++
 .../jena/rdf/model/impl/ResourceImpl.java       | 18 +++++++-
 .../jena/rdf/model/test/AbstractTestModel.java  | 47 +++++++++++++++++++-
 3 files changed, 87 insertions(+), 3 deletions(-)
----------------------------------------------------------------------