This is an automated email from the ASF dual-hosted git repository.
andy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jena.git
The following commit(s) were added to refs/heads/master by this push:
new 2a13a9c JENA-1847: Expand javadoc for getLocalName and getNameSpace.
2a13a9c is described below
commit 2a13a9c633f1c8661c1a446a9d98819391c09477
Author: Andy Seaborne <[email protected]>
AuthorDate: Fri Feb 21 22:46:33 2020 +0000
JENA-1847: Expand javadoc for getLocalName and getNameSpace.
---
.../java/org/apache/jena/rdf/model/Property.java | 48 ++++++++++++++--------
.../java/org/apache/jena/rdf/model/Resource.java | 20 +++++++--
2 files changed, 46 insertions(+), 22 deletions(-)
diff --git a/jena-core/src/main/java/org/apache/jena/rdf/model/Property.java
b/jena-core/src/main/java/org/apache/jena/rdf/model/Property.java
index 4eeac22..e13ae3c 100644
--- a/jena-core/src/main/java/org/apache/jena/rdf/model/Property.java
+++ b/jena-core/src/main/java/org/apache/jena/rdf/model/Property.java
@@ -21,29 +21,41 @@ package org.apache.jena.rdf.model;
/** An RDF Property.
*/
public interface Property extends Resource {
-
- public boolean isProperty();
- /** Returns the namespace associated with this property.
- * @return The namespace for this property.
+ public boolean isProperty();
+ /** Returns the namespace associated with this resource if it is a URI,
else return null.
+ * <p>
+ * The namespace is suitable for use with localname in in RDF/XML.
+ * XML does not allow QNames to start with a digit and this method
+ * reflects that restriction in the values for namespace and localname.
+ * <p>
+ * See functions in {@code SplitIRI} for other split algorithms.
+ *
+ * @return The namespace for this resource or null.
*/
- @Override
-public String getNameSpace();
+ @Override
+ public String getNameSpace();
- /**
+ /**
Override RDFNode.inModel() to produce a staticly-typed Property
in the given Model.
- */
- @Override
-public Property inModel( Model m );
-
- /** Returns the name of this property within its namespace.
- * @return The name of this property within its namespace.
*/
- @Override
-public String getLocalName();
-
- /** Returns the ordinal value of a containment property.
+ @Override
+ public Property inModel( Model m );
+
+ /** Returns the localname of this resource within its namespace if it is a
URI else null.
+ * <p>
+ * Note: XML requires QNames to start with a letter, not a digit,
+ * and this method reflects that restriction.
+ * <p>
+ * See functions in {@code SplitIRI}.
+ * @return The localname of this property within its namespace.
+ */
+
+ @Override
+ public String getLocalName();
+
+ /** Returns the ordinal value of a containment property.
*
* <p>RDF containers use properties of the form _1, _2, _3 etc to represent
* the containment relationship between the container and the objects it
@@ -54,5 +66,5 @@ public String getLocalName();
* or 0 otherwise.
*
*/
- public int getOrdinal();
+ public int getOrdinal();
}
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 aaa7245..ac55405 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
@@ -82,13 +82,25 @@ public interface Resource extends RDFNode {
*/
public String getURI();
- /** Returns the namespace associated with this resource.
- * @return The namespace for this property.
+ /** Returns the namespace associated with this resource if it is a URI,
else return null.
+ * <p>
+ * The namespace is suitable for use with localname in in RDF/XML.
+ * XML does not allow QNames to start with a digit and this method
+ * reflects that restriction in the values for namespace and localname.
+ * <p>
+ * See functions in {@code SplitIRI} for other split algorithms.
+ *
+ * @return The namespace for this resource or null.
*/
public String getNameSpace();
- /** Returns the name of this resource within its namespace.
- * @return The name of this property within its namespace.
+ /** Returns the localname of this resource within its namespace if it is a
URI else null.
+ * <p>
+ * Note: XML requires QNames to start with a letter, not a digit,
+ * and this method reflects that restriction.
+ * <p>
+ * See functions in {@code SplitIRI} for other split algorithms.
+ * @return The localname of this property within its namespace.
*/
public String getLocalName();