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 c5e8d69 JENA-1816: Updates of the RDF namespace
new 0840c96 Merge pull request #671 from afs/jena1816-rdf-ns
c5e8d69 is described below
commit c5e8d6939274df3505a8beae81901b61c9a945ab
Author: Andy Seaborne <[email protected]>
AuthorDate: Wed Jan 15 14:19:48 2020 +0000
JENA-1816: Updates of the RDF namespace
---
.../apache/jena/datatypes/xsd/impl/RDFjson.java | 55 ++++++++++++++++++++++
.../main/java/org/apache/jena/vocabulary/RDF.java | 44 ++++++++++++++---
2 files changed, 93 insertions(+), 6 deletions(-)
diff --git
a/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/RDFjson.java
b/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/RDFjson.java
new file mode 100644
index 0000000..d2ee6a4
--- /dev/null
+++ b/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/RDFjson.java
@@ -0,0 +1,55 @@
+/**
+ * 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.jena.datatypes.xsd.impl;
+
+import org.apache.jena.datatypes.BaseDatatype ;
+import org.apache.jena.datatypes.RDFDatatype ;
+import org.apache.jena.graph.impl.LiteralLabel ;
+
+/** rdf:json.
+ * This only implements syntactic equality, not value equality.
+ */
+
+public class RDFjson extends BaseDatatype implements RDFDatatype {
+ /** Singleton instance */
+ // Include the string for the RDF namespace, not use RDF.getURI(), to
avoid an initializer circularity
+ public static final RDFDatatype rdfJSON = new
RDFjson("http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON");
+
+ /**
+ * Private constructor.
+ */
+ private RDFjson(String uri) {
+ super(uri);
+ }
+
+ /**
+ * Compares two instances of values of the given datatype.
+ */
+ @Override
+ public boolean isEqual(LiteralLabel value1, LiteralLabel value2) {
+ return isEqualByTerm(value1, value2) ;
+ }
+
+ @Override
+ public Object parse(String lexicalForm) { return lexicalForm ; }
+
+ @Override
+ public String unparse(Object value) { return value.toString(); }
+}
+
diff --git a/jena-core/src/main/java/org/apache/jena/vocabulary/RDF.java
b/jena-core/src/main/java/org/apache/jena/vocabulary/RDF.java
index aa0601a..b6a39f9 100644
--- a/jena-core/src/main/java/org/apache/jena/vocabulary/RDF.java
+++ b/jena-core/src/main/java/org/apache/jena/vocabulary/RDF.java
@@ -21,6 +21,7 @@ package org.apache.jena.vocabulary;
import org.apache.jena.datatypes.RDFDatatype ;
import org.apache.jena.datatypes.xsd.impl.RDFLangString ;
import org.apache.jena.datatypes.xsd.impl.RDFhtml ;
+import org.apache.jena.datatypes.xsd.impl.RDFjson;
import org.apache.jena.datatypes.xsd.impl.XMLLiteralType ;
import org.apache.jena.graph.Node ;
import org.apache.jena.rdf.model.Property ;
@@ -52,7 +53,7 @@ public class RDF{
public static Property li( int i )
{ return property( "_" + i ); }
-
+
public static final Resource Alt = Init.Alt();
public static final Resource Bag = Init.Bag();
public static final Resource Property = Init._Property();
@@ -81,6 +82,23 @@ public class RDF{
public static final RDFDatatype dtRDFHTML = Init.dtRDFHTML();
public static final RDFDatatype dtLangString = Init.dtLangString();
public static final RDFDatatype dtXMLLiteral = Init.dtXMLLiteral();
+
+ // Added to the RDF namespace December 2019
+ // https://lists.w3.org/Archives/Public/semantic-web/2019Dec/0027.html
+
+ // rdfs:comment "The datatype of RDF literals storing JSON content."
+ public static final RDFDatatype dtRDFJSON = Init.dtRDFJSON();
+ public static final Resource JSON = Init.JSON();
+
+ // rdfs:comment "A class representing a compound literal."
+ public static final Resource CompoundLiteral = Init.CompoundLiteral();
+
+ // rdfs:comment "The language component of a CompoundLiteral."
+ public static final Property language = Init.language();
+
+ // rdfs:comment "The base direction component of a CompoundLiteral."
+ public static final Property direction = Init.direction();
+
/** RDF constants are used during Jena initialization.
* <p>
@@ -90,15 +108,16 @@ public class RDF{
* So for these cases, call this helper class: Init.function()
*/
public static class Init {
+
// JENA-1294
// Version that calculate the constant when called.
public static Resource Alt() { return resource( "Alt" ); }
public static Resource Bag() { return resource( "Bag" ); }
// Java8 bug : https://bugzilla.redhat.com/show_bug.cgi?id=1423421
- // Can't have a methdo called Property() - it crashes the javadoc
generation.
+ // Can't have a method called Property() - it crashes the javadoc
generation.
// https://bugzilla.redhat.com/show_bug.cgi?id=1423421 ==>
// https://bugs.openjdk.java.net/browse/JDK-8061305
- public static Resource _Property() { return resource(
"Property" ); }
+ public static Resource _Property() { return resource(
"Property" ); }
public static Resource Seq() { return resource( "Seq" ); }
public static Resource Statement() { return resource(
"Statement" ); }
public static Resource List() { return resource( "List" );
}
@@ -111,13 +130,20 @@ public class RDF{
public static Property type() { return property( "type" );
}
public static Property value() { return property( "value"
); }
- public static Resource langString() { return
ResourceFactory.createResource(dtLangString().getURI()) ; }
- public static Resource HTML() { return
ResourceFactory.createResource(dtRDFHTML().getURI()) ; }
- public static Resource xmlLiteral() { return
ResourceFactory.createResource(dtXMLLiteral().getURI()) ; }
+ public static Resource langString() { return
ResourceFactory.createResource(dtLangString().getURI()); }
+ public static Resource HTML() { return
ResourceFactory.createResource(dtRDFHTML().getURI()); }
+ public static Resource xmlLiteral() { return
ResourceFactory.createResource(dtXMLLiteral().getURI()); }
+ public static Resource JSON() { return
ResourceFactory.createResource(dtRDFJSON().getURI()) ; }
+ public static Resource CompoundLiteral() { return resource(
"CompoundLiteral" ); }
+ public static Property language() { return property(
"language" ); }
+ public static Property direction() { return property(
"direction" ); }
+
public static RDFDatatype dtRDFHTML() { return RDFhtml.rdfHTML; }
public static RDFDatatype dtLangString() { return
RDFLangString.rdfLangString; }
public static RDFDatatype dtXMLLiteral() { return
XMLLiteralType.theXMLLiteralType; }
+ public static RDFDatatype dtRDFJSON() { return RDFjson.rdfJSON; }
+
}
/**
@@ -144,5 +170,11 @@ public class RDF{
public static final Node langString = Init.langString().asNode();
public static final Node HTML = Init.HTML().asNode();
public static final Node xmlLiteral = Init.xmlLiteral().asNode();
+ // Added to the RDF namespace December 2019
+ // https://lists.w3.org/Archives/Public/semantic-web/2019Dec/0027.html
+ public static final Node JSON = Init.JSON().asNode();
+ public static final Node CompoundLiteral =
Init.CompoundLiteral().asNode();
+ public static final Node language = Init.language().asNode();
+ public static final Node direction = Init.direction().asNode();
}
}