jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/3] jena git commit: Update comments for RDF 1.1 usage. Introduce createStringLiteral.
Date Mon, 25 Jan 2016 13:08:35 GMT
Update comments for RDF 1.1 usage.  Introduce createStringLiteral.

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

Branch: refs/heads/master
Commit: 63bfe42c7dc8d6b9498c4c5f6bb42aa2a3ba6e09
Parents: 937679d
Author: Andy Seaborne <andy@apache.org>
Authored: Mon Jan 25 13:06:29 2016 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Mon Jan 25 13:06:29 2016 +0000

----------------------------------------------------------------------
 .../apache/jena/rdf/model/ResourceFactory.java  | 74 ++++++++++++++------
 .../rdf/model/test/TestResourceFactory.java     |  2 +-
 2 files changed, 55 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/63bfe42c/jena-core/src/main/java/org/apache/jena/rdf/model/ResourceFactory.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/rdf/model/ResourceFactory.java b/jena-core/src/main/java/org/apache/jena/rdf/model/ResourceFactory.java
index b70493a..1a0d342 100644
--- a/jena-core/src/main/java/org/apache/jena/rdf/model/ResourceFactory.java
+++ b/jena-core/src/main/java/org/apache/jena/rdf/model/ResourceFactory.java
@@ -93,31 +93,55 @@ public class ResourceFactory {
     }
     
     /**
-    Answer a plain (untyped) literal with no language and the given content.
-    @param string the string which forms the value of the literal
-    @return a Literal node with that string as value
+     * Answer a string (xsd:string) literal.
+     * This is the equivalent of a plain liteal with no language from RDF 1.0
+     * (also called a simple literal in SPARQL)
+     * 
+     * Using {@link #createStringLiteral} is preferred; "plain literal" is RDF 1.0 terminology.
 
+     * 
+     * @param string
+     *            the string which forms the value of the literal
+     * @return a Literal node with that string as value
      */
     public static Literal createPlainLiteral( String string ) {
-        return instance.createPlainLiteral( string );
+        return instance.createStringLiteral( string );
     }
     
     /**
-    Answer a plain (untyped) literal with no language and the given content.
-    @param string the string which forms the value of the literal
-    @param lang The language tag to be used
-    @return a Literal node with that string as value
+     * Answer a string (xsd:string) literal.
+     * This is the equivalent of a plain liteal with no language from RDF 1.0
+     * (also called a simple literal in SPARQL)
+     * 
+     * @param string
+     *            the string which forms the value of the literal
+     * @return a Literal node with that string as value
+     */
+    public static Literal createStringLiteral( String string ) {
+        return instance.createStringLiteral( string );
+    }
+    /**
+     * Answer a literal with language and the given content. The literal will
+     * have datatype rdf:langString.
+     * 
+     * @param string
+     *            the string which forms the value of the literal
+     * @param lang
+     *            The language tag to be used
+     * @return a Literal node with that string as value
      */
-
     public static Literal createLangLiteral( String string , String lang ) {
         return instance.createLangLiteral( string , lang );
     }
 
     /**
-    Answer a typed literal.
-    @param string the string which forms the value of the literal
-    @param dType RDFDatatype of the type literal
-    @return a Literal node with that string as value
-    */
+     * Answer a typed literal.
+     * 
+     * @param string
+     *            the string which forms the value of the literal
+     * @param dType
+     *            RDFDatatype of the type literal
+     * @return a Literal node with that string as value
+     */
 
     public static Literal createTypedLiteral( String string , RDFDatatype dType)
     {
@@ -189,11 +213,21 @@ public class ResourceFactory {
         public Resource createResource(String uriref);
         
         /**
-            Answer a plain (untyped) literal with no language and the given content.
-            @param string the string which forms the value of the literal
-            @return a Literal node with that string as value
-        */
-        public Literal createPlainLiteral( String string );
+         * Answer a string (xsd:string) literal.
+         * This is the equivalent of a plain liteal with no language from RDF 1.0
+         * (also called a simple literal in SPARQL)
+         * 
+         * @param string
+         *            the string which forms the value of the literal
+         * @return a Literal node with that string as value
+         */
+        public Literal createStringLiteral( String string );
+        
+        /** Use createStringLiteral */
+        @Deprecated 
+        default public Literal createPlainLiteral( String string ) {
+            return createStringLiteral( string );
+        }
 
         /**
         Answer a plain (untyped) literal with no language and the given content.
@@ -264,7 +298,7 @@ public class ResourceFactory {
         }
         
         @Override
-        public Literal createPlainLiteral( String string ) {
+        public Literal createStringLiteral( String string ) {
             return new LiteralImpl(  NodeFactory.createLiteral( string, "" ), null );
         }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/63bfe42c/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestResourceFactory.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestResourceFactory.java
b/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestResourceFactory.java
index f477f2d..a2c83ef 100644
--- a/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestResourceFactory.java
+++ b/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestResourceFactory.java
@@ -49,7 +49,7 @@ public class TestResourceFactory extends TestCase
 		}
 
 		@Override
-		public Literal createPlainLiteral( final String string )
+		public Literal createStringLiteral( final String string )
 		{
 			return null;
 		}


Mime
View raw message