Merge pull request #1949 from afs/deprecate
Deprecate various API calls
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/lang/ReaderRIOTRDFXML.java b/jena-arq/src/main/java/org/apache/jena/riot/lang/ReaderRIOTRDFXML.java
index fc37764..ffd0b4b 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/lang/ReaderRIOTRDFXML.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/lang/ReaderRIOTRDFXML.java
@@ -213,6 +213,7 @@
{ output.triple(convert(subj, pred, lit)) ; }
// From JenaReader
+ @SuppressWarnings("deprecation")
private static Node convert(ALiteral lit) {
String dtURI = lit.getDatatypeURI();
if (dtURI == null)
diff --git a/jena-core/src/main/java/org/apache/jena/graph/NodeFactory.java b/jena-core/src/main/java/org/apache/jena/graph/NodeFactory.java
index df61cc2..37727a4 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/NodeFactory.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/NodeFactory.java
@@ -55,12 +55,6 @@
return new Node_Blank(id) ;
}
- /** make a literal node with the specified literal value */
- public static Node createLiteral(LiteralLabel lit) {
- Objects.requireNonNull(lit, "Argument to NodeFactory.createLiteral is null") ;
- return new Node_Literal( lit ) ;
- }
-
/** make a URI node with the specified URIref string */
public static Node createURI(String uri) {
Objects.requireNonNull(uri, "Argument to NodeFactory.createURI is null") ;
@@ -80,6 +74,15 @@
}
+ /** make a literal node with the specified literal value
+ * @deprecated Making nodes directly from {@link LiteralLabel} may be removed.
+ */
+ @Deprecated
+ public static Node createLiteral(LiteralLabel lit) {
+ Objects.requireNonNull(lit, "Argument to NodeFactory.createLiteral is null") ;
+ return new Node_Literal( lit ) ;
+ }
+
public static Node createLiteral(String value) {
Objects.requireNonNull(value, "Argument to NodeFactory.createLiteral is null") ;
return createLiteral(value, "", false) ;
@@ -94,7 +97,9 @@
* @param isXml
* If true then lit is exclusive canonical XML of type
* rdf:XMLLiteral, and no checking will be invoked.
+ @deprecated To be removed.
*/
+ @Deprecated
public static Node createLiteral(String lex, String lang, boolean isXml) {
if ( lex == null )
throw new NullPointerException("null lexical form for literal") ;
diff --git a/jena-core/src/main/java/org/apache/jena/rdf/model/Literal.java b/jena-core/src/main/java/org/apache/jena/rdf/model/Literal.java
index b0bc138..1cc13a0 100644
--- a/jena-core/src/main/java/org/apache/jena/rdf/model/Literal.java
+++ b/jena-core/src/main/java/org/apache/jena/rdf/model/Literal.java
@@ -179,7 +179,9 @@
/**
Answer true iff this literal is (or claims to be) well-formed XML.
- */
+ @deprecated To be removed. Well-formness of XML literal is not tested for.
+ */
+ @Deprecated
public boolean isWellFormedXML();
/** Test whether another object is equal to this object.
diff --git a/jena-core/src/main/java/org/apache/jena/rdf/model/Model.java b/jena-core/src/main/java/org/apache/jena/rdf/model/Model.java
index 852fc17..f70201a 100644
--- a/jena-core/src/main/java/org/apache/jena/rdf/model/Model.java
+++ b/jena-core/src/main/java/org/apache/jena/rdf/model/Model.java
@@ -250,7 +250,10 @@
@param v the lexical form of the literal
@param wellFormed true if the Literal is well formed XML, in the lexical space of rdf:XMLLiteral
@return a new literal
+
+ @deprecated To be removed. Argument 'wellFormed' is ignored
*/
+ @Deprecated
public Literal createLiteral(String v, boolean wellFormed);
/**
diff --git a/jena-core/src/main/java/org/apache/jena/rdf/model/ModelCon.java b/jena-core/src/main/java/org/apache/jena/rdf/model/ModelCon.java
index 949d28f..1fb8583 100644
--- a/jena-core/src/main/java/org/apache/jena/rdf/model/ModelCon.java
+++ b/jena-core/src/main/java/org/apache/jena/rdf/model/ModelCon.java
@@ -27,7 +27,7 @@
/** Convenience methods which extend the {@link Model} interface.
* <P>The {@link Model} interface provides a set of primitive operations on
- * an RDF model. This interface extends those methods with a
+ * an RDF model. This interface extends those methods with a
* set of convenience methods.</P>
* <p>This interface provides methods supporting typed literals. This means
* that methods are provided which will translate a built in type, or an
@@ -54,8 +54,8 @@
* @return a resource instance created by the factory provided
* @param uri the URI of the resource
* @param f the factory object
-
- */
+
+ */
@Deprecated Resource getResource(String uri, ResourceF f) ;
/** Return a Property instance in this model.
@@ -65,7 +65,7 @@
* <CODE>createProperty</CODE> should be used instead.</p>
* @return a property object
* @param uri the URI of the property
-
+
*/
Property getProperty(String uri) ;
@@ -76,8 +76,8 @@
* <CODE>createBag</CODE> should be used instead.</p>
* @return a bag instance
* @param uri the URI of the bag.
-
- */
+
+ */
Bag getBag(String uri) ;
/** Return a bag instance based on a given resource.
@@ -89,9 +89,9 @@
* <p>The bag is assumed to already exist in the model. If it does not,
* <CODE>createBag</CODE> should be used instead.</p>
* @return a bag instance
- * @param r an untyped Resource instance
-
- */
+ * @param r an untyped Resource instance
+
+ */
Bag getBag(Resource r) ;
/** Return an Alt instance in this model.
@@ -101,8 +101,8 @@
* <CODE>createAlt</CODE> should be used instead.</p>
* @return an alt instance
* @param uri the URI of the alt
-
- */
+
+ */
Alt getAlt(String uri) ;
/** Return an Alt instance based on a given resource.
@@ -115,10 +115,10 @@
* <CODE>createAlt</CODE> should be used instead.</p>
* @return an Alt instance
* @param r an untyped Resource instance
-
- */
+
+ */
Alt getAlt(Resource r) ;
-
+
/** Return a Seq instance in this model.
*
* <p>Subsequent operations on the returned sequence may modify this model.</p>
@@ -126,10 +126,10 @@
* <CODE>createSeq</CODE> should be used instead.</p>
* @return a seq instance
* @param uri the URI of the seq
-
- */
+
+ */
Seq getSeq(String uri) ;
-
+
/** Return a Seq instance based on a given resource.
*
* <p> This method enables an application to treat any resource as a Seq.
@@ -140,8 +140,8 @@
* <CODE>createSeq</CODE> should be used instead.</p>
* @return an Seq instance
* @param r an untyped Resource instance
-
- */
+
+ */
Seq getSeq(Resource r) ;
/** Return a RDF List instance in this model.
@@ -151,11 +151,11 @@
* <CODE>createList</CODE> should be used instead.</p>
* @return a list instance
* @param uri the URI of the list
- */
+ */
RDFList getList(String uri) ;
/** Return a RDF List based on a given resource.
- *
+ *
* <p> This method enables an application to treat any resource as a list.
* It is in effect an unsafe downcast.</p>
*
@@ -164,7 +164,7 @@
* <CODE>createList</CODE> should be used instead.</p>
* @return a list instance
* @param r the resource of the list
- */
+ */
RDFList getList(Resource r) ;
/** Create a new anonymous resource with a given type.
@@ -177,17 +177,17 @@
* @return a new anonymous resource linked to this model.
*/
public Resource createResource(Resource type) ;
-
+
/**
- Create or find an RDFNode
+ Create or find an RDFNode
(a {@link Resource} or a {@link Literal})
from a graph Node. This is provided for users and
developers operating at the API/SPI interface, where Resources are
constructed from Nodes. Providing this method allows each Model
- the opportunity to cache node-to-resource maps if it requires.
-
+ the opportunity to cache node-to-resource maps if it requires.
+
@param n the graph.Node on which to base the Model.RDFNode
- @return a suitable RDFNode
+ @return a suitable RDFNode
*/
public RDFNode getRDFNode( Node n );
@@ -212,7 +212,7 @@
.
*/
@Deprecated public Resource createResource(ResourceF f) ;
-
+
/** Create a new resource using the supplied factory.
*
* <p> Subsequent operations on the returned resource may modify this model.
@@ -221,7 +221,7 @@
* @param uri the URI of the resource
* @param f A factory to create the returned object.
.
- */
+ */
@Deprecated public Resource createResource(String uri, ResourceF f) ;
/** Create a property.
@@ -229,18 +229,18 @@
* <p> Subsequent operations on the returned property may modify this model.
* </p>
* @param uri the URI of the property
-
+
* @return a property instance
*/
public Property createProperty(String uri) ;
-
+
/** create a literal from a String value.
*
* @param v the value of the literal
* @return a new literal representing the value v
*/
public Literal createLiteral( String v );
-
+
/** create a type literal from a boolean value.
*
* <p> The value is converted to a string using its <CODE>toString</CODE>
@@ -248,55 +248,55 @@
* @param v the value of the literal
* @return a new literal representing the value v
*/
- public Literal createTypedLiteral(boolean v) ;
-
+ public Literal createTypedLiteral(boolean v) ;
+
/** create a typed literal from an integer value.
*
* @param v the value of the literal
* @return a new literal representing the value v
- */
+ */
public Literal createTypedLiteral(int v) ;
-
+
/** create a typed literal from an integer value.
*
* @param v the value of the literal
* @return a new literal representing the value v
- */
+ */
public Literal createTypedLiteral(long v) ;
/**
- * Create a typed literal of type xsd:dateTime from a Calendar object.
+ * Create a typed literal of type xsd:dateTime from a Calendar object.
*/
public Literal createTypedLiteral(Calendar d);
-
+
/** create a typed literal from a char value.
*
* @param v the value of the literal
* @return a new literal representing the value v
*/
public Literal createTypedLiteral(char v) ;
-
+
/** create a typed literal from a float value.
*
* @param v the value of the literal
* @return a new literal representing the value v
*/
public Literal createTypedLiteral(float v) ;
-
+
/** create a typed literal from a double value.
*
* @param v the value of the literal
* @return a new literal representing the value v
*/
public Literal createTypedLiteral(double v) ;
-
+
/** create a typed literal from a String value.
*
* @param v the value of the literal
* @return a new literal representing the value v
*/
public Literal createTypedLiteral(String v) ;
-
+
/** create a literal from an Object.
*
* @return a new literal representing the value v
@@ -312,71 +312,71 @@
* Note that in preview releases of Jena2 it was also possible to specify
* a language type. Changes to the RDF specification mean that this is no longer
* legal except for plain literals. To create a plain literal with a language tag
- * use {@link Model#createLiteral(String, String) createLiteral}.
- * </p>
- *
+ * use {@link Model#createLiteral(String, String) createLiteral}.
+ * </p>
+ *
* @param lex the lexical form of the literal
* @param typeURI the uri of the type of the literal, null for old style "plain" literals
* @throws DatatypeFormatException if lex is not a legal form of dtype
*/
public Literal createTypedLiteral(String lex, String typeURI) ;
-
+
/**
* Build a typed literal from its value form.
* <p>
* Note that in preview releases of Jena2 it was also possible to specify
* a language type. Changes to the RDF specification mean that this is no longer
* legal except for plain literals. To create a plain literal with a language tag
- * use {@link Model#createLiteral(String, String) createLiteral}.
- * </p>
- *
+ * use {@link Model#createLiteral(String, String) createLiteral}.
+ * </p>
+ *
* @param value the value of the literal
* @param typeURI the URI of the type of the literal, null for old style "plain" literals
*/
public Literal createTypedLiteral(Object value, String typeURI);
-
- /**
+
+ /**
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
*/
public Statement createLiteralStatement( Resource s, Property p, boolean o );
-
- /**
+
+ /**
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
*/
public Statement createLiteralStatement( Resource s, Property p, float o );
-
- /**
+
+ /**
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
*/
public Statement createLiteralStatement( Resource s, Property p, double o );
-
- /**
+
+ /**
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
*/
public Statement createLiteralStatement( Resource s, Property p, long o );
-
- /**
+
+ /**
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
*/
public Statement createLiteralStatement( Resource s, Property p, int o );
-
- /**
+
+ /**
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
*/
public Statement createLiteralStatement( Resource s, Property p, char o );
- /**
+ /**
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
*/
public Statement createLiteralStatement( Resource s, Property p, Object o );
-
+
/** Create a Statement instance.
*
* <p>Subsequent operations on the statement or any of its parts may
@@ -387,11 +387,11 @@
* @param s the subject of the statement
* @param p the predicate of the statement
* @param o is the value to be the object of the statement
-
+
* @return the new statement
*/
public Statement createStatement(Resource s, Property p, String o) ;
-
+
/** Create a Statement instance.
*
* <p>Subsequent operations on the statement or any of its parts may
@@ -403,7 +403,7 @@
* @param p the predicate of the statement
* @param o is the value to be the object of the statement
* @param l the language associated with the object
-
+
* @return the new statement
*/
public Statement createStatement(Resource s, Property p, String o, String l) ;
@@ -419,12 +419,12 @@
* @param p the predicate of the statement
* @param o is the value to be the object of the statement
* @param wellFormed true if the string is well formed XML
-
+
* @return the new statement
*/
public Statement createStatement(Resource s, Property p, String o,
boolean wellFormed) ;
-
+
/** Create a Statement instance.
*
* <p>Subsequent operations on the statement or any of its parts may
@@ -437,12 +437,15 @@
* @param o is the value to be the object of the statement
* @param l the language associated with the object
* @param wellFormed true of the string is well formed XML
-
+
* @return the new statement
+ *
+ * @deprecated To be removed. Argument 'wellFormed' is ignored
*/
+ @Deprecated
public Statement createStatement(Resource s, Property p, String o, String l, boolean wellFormed) ;
-
+
/** Create a new anonymous bag.
*
* <p>Subsequent operations on the bag or any of its parts may
@@ -452,7 +455,7 @@
* @return a new anonymous bag.
*/
public Bag createBag() ;
-
+
/** Create a new bag.
*
* <p>Subsequent operations on the bag or any of its parts may
@@ -463,7 +466,7 @@
* @return a new bag.
*/
public Bag createBag(String uri) ;
-
+
/** Create a new anonymous alt.
*
* <p>Subsequent operations on the alt or any of its parts may
@@ -473,7 +476,7 @@
* @return a new anonymous alt.
*/
public Alt createAlt() ;
-
+
/** Create a new alt.
*
* <p>Subsequent operations on the alt or any of its parts may
@@ -484,7 +487,7 @@
* @return a new alt.
*/
public Alt createAlt(String uri) ;
-
+
/** Create a new anonymous seq.
*
* <p>Subsequent operations on the seq or any of its parts may
@@ -494,7 +497,7 @@
* @return a new anonymous seq.
*/
public Seq createSeq() ;
-
+
/** Create a new seq.
*
* <p>Subsequent operations on the seq or any of its parts may
@@ -511,54 +514,54 @@
* @param s the subject of the statement to add
* @param p the predicate of the statement to add
* @param o the object of the statement to add
- */
+ */
Model add(Resource s, Property p, RDFNode o) ;
- /**
+ /**
Add the statement (s, p, createTypedLiteral( o )) to this model and
answer this model.
- */
+ */
Model addLiteral( Resource s, Property p, boolean o );
-
+
/**
Add the statement (s, p, createTypedLiteral( o )) to this model and
answer this model.
- */
+ */
Model addLiteral( Resource s, Property p, long o );
-
+
/**
Add the statement (s, p, createTypedLiteral( o )) to this model and
answer this model.
- */
+ */
Model addLiteral( Resource s, Property p, int o );
-
+
/**
Add the statement (s, p, createTypedLiteral( o )) to this model and
answer this model.
- */
+ */
Model addLiteral( Resource s, Property p, char o ) ;
-
- /**
+
+ /**
Add the statement (s, p, o') to the model, where o' is the typed
literal corresponding to o. Answer this model.
- */
+ */
Model addLiteral( Resource s, Property p, float o );
- /**
+ /**
Add the statement (s, p, o') to the model, where o' is the typed
literal corresponding to o. Answer this model.
- */
+ */
Model addLiteral( Resource s, Property p, double o ) ;
/** add a statement to this model.
- * Applications should use typed literals whereever possible.
+ * Applications should use typed literals whereever possible.
*
* @return this model
* @param s the subject of the statement to add
* @param p the predicate of the statement to add
* @param o the object of the statement to add
* @deprecated Freshly (should have been done a while ago)
- */
+ */
@Deprecated Model addLiteral( Resource s, Property p, Object o );
/** add a statement to this model.
@@ -567,7 +570,7 @@
* @param s the subject of the statement to add
* @param p the predicate of the statement to add
* @param o the object of the statement to add
- */
+ */
Model addLiteral( Resource s, Property p, Literal o );
/** add a statement to this model.
@@ -576,7 +579,7 @@
* @param s the subject of the statement to add
* @param p the predicate of the statement to add
* @param o the object of the statement to add
- */
+ */
Model add(Resource s, Property p, String o) ;
/** add a statement to this model.
@@ -586,99 +589,99 @@
* @param p the predicate of the statement to add
* @param lex the lexcial form of the literal
* @param datatype the datatype of the literal
- */
+ */
Model add(Resource s, Property p, String lex, RDFDatatype datatype) ;
-
-
-/** add a statement to this model.
- *
- * @return this model
- * @param s the subject of the statement to add
- * @param p the predicate of the statement to add
- * @param o the object of the statement to add
- * @param wellFormed true if o is well formed XML
- */
+ /** add a statement to this model.
+ *
+ * @return this model
+ * @param s the subject of the statement to add
+ * @param p the predicate of the statement to add
+ * @param o the object of the statement to add
+ * @param wellFormed true if o is well formed XML
+ * @deprecated To be removed. Argument 'wellFormed' is ignored
+ */
+ @Deprecated
Model add(Resource s, Property p, String o, boolean wellFormed);
-/** add a statement to this model.
- *
- * @return this model
- * @param s the subject of the statement to add
- * @param p the predicate of the statement to add
- * @param o the object of the statement to add
- * @param l the language associated with the object
-
- */
+ /** add a statement to this model.
+ *
+ * @return this model
+ * @param s the subject of the statement to add
+ * @param p the predicate of the statement to add
+ * @param o the object of the statement to add
+ * @param l the language associated with the object
+
+ */
Model add(Resource s, Property p, String o, String l) ;
-/**
+ /**
remove the statement <code>(s, p, o)</code> from this model and
answer this model. None of <code>s, p, o</code> are permitted to
be <code>null</code>: for wildcard removal, see <code>removeAll</code>.
- */
+ */
Model remove( Resource s, Property p, RDFNode o );
-
+
/** Remove all the Statements returned by an iterator.
* @return this model
* @param iter the iterator which returns the statements to be removed.
-
- */
+
+ */
Model remove(StmtIterator iter) ;
/** Remove all the Statements in a given model, including reified statements
* @return this model
* @param m the model containing the statements to be removed.
-
- */
+
+ */
Model remove(Model m) ;
-
- /**
+
+ /**
Answer a statement iterator that will iterate over all the statements
(S, P, O) in this model where S matches <code>subject</code>, P
matches <code>predicate</code>, and O matches the typed literal
corresponding to <code>object</code>.
- */
+ */
StmtIterator listLiteralStatements( Resource subject, Property predicate, boolean object );
- /**
+ /**
Answer a statement iterator that will iterate over all the statements
(S, P, O) in this model where S matches <code>subject</code>, P
matches <code>predicate</code>, and O matches the typed literal
corresponding to <code>object</code>.
- */
+ */
StmtIterator listLiteralStatements( Resource subject, Property predicate, char object );
- /**
+ /**
Answer a statement iterator that will iterate over all the statements
(S, P, O) in this model where S matches <code>subject</code>, P
matches <code>predicate</code>, and O matches the typed literal
corresponding to <code>object</code>.
- */
+ */
StmtIterator listLiteralStatements(Resource subject, Property predicate, long object );
- /**
+ /**
Answer a statement iterator that will iterate over all the statements
(S, P, O) in this model where S matches <code>subject</code>, P
matches <code>predicate</code>, and O matches the typed literal
corresponding to <code>object</code>.
- */
+ */
StmtIterator listLiteralStatements(Resource subject, Property predicate, int object );
- /**
+ /**
Answer a statement iterator that will iterate over all the statements
(S, P, O) in this model where S matches <code>subject</code>, P
matches <code>predicate</code>, and O matches the typed literal
corresponding to <code>object</code>.
- */
+ */
StmtIterator listLiteralStatements( Resource subject, Property predicate, float object );
- /**
+ /**
Answer a statement iterator that will iterate over all the statements
(S, P, O) in this model where S matches <code>subject</code>, P
matches <code>predicate</code>, and O matches the typed literal
corresponding to <code>object</code>.
- */
+ */
StmtIterator listLiteralStatements(Resource subject, Property predicate, double object );
/** Find all the statements matching a pattern.
@@ -691,8 +694,8 @@
* @param subject The subject sought
* @param predicate The predicate sought
* @param object The value sought
-
- */
+
+ */
StmtIterator listStatements( Resource subject, Property predicate, String object );
/** Find all the statements matching a pattern.
@@ -707,8 +710,8 @@
* @param predicate The predicate sought
* @param object The value sought
* @param lang The lang code ofthe string.
-
- */
+
+ */
StmtIterator listStatements(Resource subject,
Property predicate,
String object,
@@ -742,7 +745,7 @@
corresponding to o.
*/
ResIterator listResourcesWithProperty( Property p, float o );
-
+
/**
Answer an iterator [without duplicates] over all the resources in this
model which have value o' for property p, where o' is the typed literal
@@ -761,19 +764,19 @@
* @return an iterator over the set of subjects
* @param p The predicate sought.
* @param o The property value sought.
- */
+ */
ResIterator listSubjectsWithProperty( Property p, String o );
-
+
/** lists all subjects with a given property and property value.
-
+
* @return an iterator over the set of subjects
* @param p The predicate sought.
* @param o The property value sought.
* @param l the language associated with the object
-
- */
+
+ */
ResIterator listSubjectsWithProperty( Property p, String o, String l );
-
+
/**
Answer true iff this model contains the statement (s, p, o') where
o' is the typed literal corresponding to the value o.
@@ -798,10 +801,10 @@
*/
boolean containsLiteral( Resource s, Property p, char o );
- /**
+ /**
Answer true iff this model contains (s, p, o') where o' is the typed
literal corresponding to o.
- */
+ */
boolean containsLiteral( Resource s, Property p, float o );
/**
@@ -815,14 +818,14 @@
o' is the typed literal corresponding to the value o.
*/
boolean containsLiteral( Resource s, Property p, Object o );
-
+
/** Determine if a statement is present in this model.
* @return true if the statement with subject s, property p and object o
* is in the model, false otherwise
* @param s The subject of the statment tested.
* @param p The predicate of the statement tested.
* @param o The object of the statement tested.
- */
+ */
boolean contains( Resource s, Property p, String o );
/** Determine if a statement is present in this model.
@@ -832,6 +835,6 @@
* @param p The predicate of the statement tested.
* @param o The object of the statement tested.
* @param l the language associated with the object
- */
+ */
boolean contains( Resource s, Property p, String o, String l );
}
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 5392ce4..1301e44 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
@@ -333,6 +333,7 @@
return new LiteralImpl(NodeFactory.createLiteral(string, dType), null) ;
}
+ @SuppressWarnings("deprecation")
@Override
public Literal createTypedLiteral( Object value ) {
LiteralLabel ll = null;
diff --git a/jena-core/src/main/java/org/apache/jena/rdf/model/Statement.java b/jena-core/src/main/java/org/apache/jena/rdf/model/Statement.java
index 5568df0..b21d778 100644
--- a/jena-core/src/main/java/org/apache/jena/rdf/model/Statement.java
+++ b/jena-core/src/main/java/org/apache/jena/rdf/model/Statement.java
@@ -40,7 +40,7 @@
public interface Statement extends FrontsTriple
{
-
+
/** determine whether two statements are equal.
*
* <p> Two statements are considered to be equal if they have the
@@ -50,30 +50,30 @@
* @return true if and only if the equality condition is met.
* @param o the object to be compared
*/
-
+
@Override
public boolean equals(Object o);
-
+
/** Returns asTriple().hashCode()
*/
@Override
public int hashCode();
-
+
/** An accessor method to return the subject of the statements.
* @return The subject of the statement.
*/
public Resource getSubject();
-
+
/** An accessor function to return the predicate of the statement.
* @return The predicate of the statement.
*/
public Property getPredicate();
-
+
/** An accessor funtion to return the object of the statement.
* @return Return the object of the statement.
*/
public RDFNode getObject();
-
+
/** Get a property of the object of the statement.
*
* <p>There is an unfortunate ambiguity here. GetProperty would normally
@@ -86,12 +86,12 @@
* <p>If the object of the statement is not a resource, an exception is
* thrown.</p>
* @param p the property sought
-
+
* @return a statement representing an instance of the required
* property
*/
public Statement getProperty(Property p) ;
-
+
/** Return a property of this statement.
*
* <p>The model associated with this statement is searched for a statement with
@@ -100,228 +100,232 @@
* model, then it is undefined which is returned. If no such statement
* exists, an exception is thrown.</p>
* @param p the property sought
-
+
* @return a statement representing an instance of the specified
* property.
*/
public Statement getStatementProperty(Property p) ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a resource.</p>
- *
+ *
* @return The Resource which is the object of the statement.
*/
public Resource getResource() ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a Literal.</p>
- *
+ *
* @return The Literal which is the object of the statement.
*/
public Literal getLiteral() ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a Literal.</p>
- *
+ *
* @return The object of the statement interpreted as a value of
* the specified type.
- */
+ */
public boolean getBoolean() ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a Literal.</p>
- *
+ *
* @return The object of the statement interpreted as a value of
* the specified type.
- */
+ */
public byte getByte() ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a Literal.</p>
- *
+ *
* @return The object of the statement interpreted as a value of
* the specified type.
- */
+ */
public short getShort() ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a Literal.</p>
- *
+ *
* @return The object of the statement interpreted as a value of
* the specified type.
- */
+ */
public int getInt() ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown iof the object is not a Literal.</p>
- *
+ *
* @return The object of the statement interpreted as a value of
* the specified type.
- */
+ */
public long getLong() ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a Literal.</p>
- *
+ *
* @return The object of the statement interpreted as a value of
* the specified type.
- */
+ */
public char getChar() ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a Literal.</p>
- *
+ *
* @return The object of the statement interpreted as a value of
* the specified type.
- */
+ */
public float getFloat() ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a Literal.</p>
- *
+ *
* @return The object of the statement interpreted as a value of
* the specified type.
- */
+ */
public double getDouble() ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a Literal.</p>
- *
+ *
* @return The object of the statement interpreted as a value of
* the specified type.
- */
+ */
public String getString() ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a Resource.</p>
* @return The object of the statement.
- *
- */
+ *
+ */
@Deprecated public Resource getResource(ResourceF f) ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a Resource.</p>
- *
+ *
* @return The object of the statement interpreted as a value of
* the specified type.
- */
+ */
public Bag getBag() ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a Resource.</p>
- *
+ *
* @return The object of the statement interpreted as a value of
* the specified type.
- */
+ */
public Alt getAlt() ;
-
+
/** Return the object of the statement.
*
* <p>An exception will be thrown if the object is not a Resource.</p>
- *
+ *
* @return The object of the statement interpreted as a value of
* the specified type.
- */
+ */
public Seq getSeq() ;
-
+
/** Return the object of the statement as an RDF List.
* <p>An exception will be thrown if the object is not an {@link RDFList}.</p>
* @return The object of the statement interpreted as a value as RDFList.
*/
public RDFList getList() ;
-
+
/** Return the language of the object of the statement.
*
* <p>An exception will be thrown if the object is not a Literal.</p>
- *
+ *
* @return the language of the object of the statement
- */
+ */
public String getLanguage();
/**
Answer true iff the Literal object of this statement is well-formed XML
(ie equivalent to getLiteral().isWellFormedXML()). If the object is not
a Literal, throw an exception.
- */
+ @deprecated To be removed.
+ */
+ @Deprecated
public boolean hasWellFormedXML();
-
- /**
+
+ /**
Remove this statement (s, p, x) from the model that contains it. Create a
new statement (s, p, o'), where o' is the typed literal corresponding to
o, add it to the model, and answer it.
*/
public Statement changeLiteralObject( boolean o );
-
- /**
+
+ /**
Remove this statement (s, p, x) from the model that contains it. Create a
new statement (s, p, o'), where o' is the typed literal corresponding to
o, add it to the model, and answer it.
*/
public Statement changeLiteralObject( long o );
-
- /**
+
+ /**
Remove this statement (s, p, x) from the model that contains it. Create a
new statement (s, p, o'), where o' is the typed literal corresponding to
o, add it to the model, and answer it.
*/
public Statement changeLiteralObject( int o );
-
- /**
+
+ /**
Remove this statement (s, p, x) from the model that contains it. Create a
new statement (s, p, o'), where o' is the typed literal corresponding to
o, add it to the model, and answer it.
*/
public Statement changeLiteralObject(char o) ;
-
- /**
+
+ /**
Remove this statement (s, p, x) from the model that contains it. Create a
new statement (s, p, o'), where o' is the typed literal corresponding to
o, add it to the model, and answer it.
*/
public Statement changeLiteralObject( float o );
-
- /**
+
+ /**
Remove this statement (s, p, x) from the model that contains it. Create a
new statement (s, p, o'), where o' is the typed literal corresponding to
o, add it to the model, and answer it.
*/
public Statement changeLiteralObject( double o );
-
+
/** change the object of the statement (S, P, X) to (S, P, o).
- * <p>The statement with the old value is removed from the model and
+ * <p>The statement with the old value is removed from the model and
* a new statement with the new value added and returned.</p>
* @param o The value to be set.
*
* @return the new (S, P, o) statement.
*/
- public Statement changeObject(String o) ;
-
+ public Statement changeObject(String o) ;
+
/** change the object of the statement (S, P, X) to (S, P, o).
- * <p>The statement with the old value is removed from the model and
+ * <p>The statement with the old value is removed from the model and
* a new statement with the new value added and returned.</p>
* @param o The value to be set.
* @param wellFormed true if o is well formed XML
*
* @return the new (S, P, o) statement.
+ * @deprecated To be removed: Argument 'wellFormed is ignored
*/
+ @Deprecated
public Statement changeObject(String o, boolean wellFormed) ;
-
+
/** change the object of the statement (S, P, X) to (S, P, o).
- * <p>The statement with the old value is removed from the model and
+ * <p>The statement with the old value is removed from the model and
* a new statement with the new value added.</p>
* @param o The value to be set.
* @param l the language of the String
@@ -329,26 +333,28 @@
* @return the new (S, P, o) statement..
*/
public Statement changeObject(String o, String l) ;
-
+
/** change the object of the statement (S, P, X) to (S, P, o).
- * <p>The statement with the old value is removed from the model and
+ * <p>The statement with the old value is removed from the model and
* a new statement with the new value added.</p>
* @param o The value to be set.
* @param l the language of the String
*
* @return the new (S, P, o) statement.
+ * @deprecated To be removed: Argument 'wellFormed is ignored
*/
- public Statement changeObject(String o, String l, boolean wellFormed)
+ @Deprecated
+ public Statement changeObject(String o, String l, boolean wellFormed)
;
-
+
/** change the object of the statement (S, P, X) to (S, P, o).
- * <p>The statement with the old value is removed from the model and
+ * <p>The statement with the old value is removed from the model and
* a new statement with the new value added.</p>
* @param o The value to be set
* @return the new (S, P, o) statement.
*/
public Statement changeObject(RDFNode o) ;
-
+
/** Remove this statement from its associated model.
*
* <p>The statement with the same subject, predicate and object as this
@@ -358,37 +364,37 @@
* @return this statement.
*/
public Statement remove() ;
-
- /**
+
+ /**
Determine if this statement is the subject of any statements its associated
model.
@return true iff this statement is the subject of a statement in the model.
- */
+ */
boolean isReified();
-
+
/**
answer a ReifiedStatement object that embodies this Statement and
is in the same Model (if any).
*/
ReifiedStatement createReifiedStatement();
-
+
/**
answer a ReifiedStatement object that embodies this Statement, has
the same Model, and has the given <code>uri</code>.
*/
ReifiedStatement createReifiedStatement( String uri );
-
+
/**
answer an iterator which delivers all the reified statements in the model
this Statement belongs to that match this Statement.
*/
RSIterator listReifiedStatements();
-
+
/**
get the Model this Statement was created in.
*/
Model getModel();
-
+
/**
* Finds all possible resources which are
* the reification of this statement, and for each
diff --git a/jena-core/src/main/java/org/apache/jena/rdf/model/impl/LiteralImpl.java b/jena-core/src/main/java/org/apache/jena/rdf/model/impl/LiteralImpl.java
index 26de448..9681d84 100644
--- a/jena-core/src/main/java/org/apache/jena/rdf/model/impl/LiteralImpl.java
+++ b/jena-core/src/main/java/org/apache/jena/rdf/model/impl/LiteralImpl.java
@@ -240,7 +240,9 @@
return asNode().getLiteralLanguage();
}
+ /** @deprecated To be removed. Well-formness of XML literal is not tested for. */
@Override
+ @Deprecated
public boolean isWellFormedXML() {
return asNode().getLiteralIsXML();
}
diff --git a/jena-core/src/main/java/org/apache/jena/rdf/model/impl/ModelCom.java b/jena-core/src/main/java/org/apache/jena/rdf/model/impl/ModelCom.java
index e7f1983..9f51de3 100644
--- a/jena-core/src/main/java/org/apache/jena/rdf/model/impl/ModelCom.java
+++ b/jena-core/src/main/java/org/apache/jena/rdf/model/impl/ModelCom.java
@@ -162,8 +162,12 @@
return this;
}
- private Literal literal( String s, String lang, boolean wellFormed )
- { return new LiteralImpl( NodeFactory.createLiteral( s, lang, wellFormed), this ); }
+ private Literal literal( String s, String lang, boolean wellFormed ) {
+ LiteralLabel ll = LiteralLabelFactory.create(s, lang, wellFormed);
+ @SuppressWarnings("deprecation")
+ Node n = NodeFactory.createLiteral(ll);
+ return new LiteralImpl( n, this );
+ }
private Literal literal( String lex, RDFDatatype datatype)
{ return new LiteralImpl( NodeFactory.createLiteral( lex, datatype), this ); }
@@ -646,7 +650,7 @@
@Override
public Literal createTypedLiteral(String v) {
LiteralLabel ll = LiteralLabelFactory.createTypedLiteral(v);
- return new LiteralImpl(NodeFactory.createLiteral(ll), this);
+ return new LiteralImpl(NodeFactory.createLiteral(v), this);
}
/**
@@ -656,7 +660,9 @@
public Literal createTypedLiteral(Calendar cal) {
Object value = new XSDDateTime(cal);
LiteralLabel ll = LiteralLabelFactory.createByValue(value, "", XSDDatatype.XSDdateTime);
- return new LiteralImpl(NodeFactory.createLiteral(ll), this);
+ @SuppressWarnings("deprecation")
+ Node n = NodeFactory.createLiteral(ll);
+ return new LiteralImpl(n, this);
}
@@ -684,7 +690,9 @@
@Override
public Literal createTypedLiteral(Object value, RDFDatatype dtype) {
LiteralLabel ll = LiteralLabelFactory.createByValue(value, "", dtype);
- return new LiteralImpl( NodeFactory.createLiteral(ll), this );
+ @SuppressWarnings("deprecation")
+ Node n = NodeFactory.createLiteral(ll);
+ return new LiteralImpl( n, this );
}
/**
@@ -700,7 +708,9 @@
public Literal createTypedLiteral(String lex, String typeURI) {
RDFDatatype dt = TypeMapper.getInstance().getSafeTypeByName(typeURI);
LiteralLabel ll = LiteralLabelFactory.create( lex, dt );
- return new LiteralImpl( NodeFactory.createLiteral(ll), this );
+ @SuppressWarnings("deprecation")
+ Node n = NodeFactory.createLiteral(ll);
+ return new LiteralImpl( n, this );
}
/**
@@ -713,7 +723,9 @@
public Literal createTypedLiteral(Object value, String typeURI) {
RDFDatatype dt = TypeMapper.getInstance().getSafeTypeByName(typeURI);
LiteralLabel ll = LiteralLabelFactory.createByValue(value, "", dt);
- return new LiteralImpl(NodeFactory.createLiteral(ll), this);
+ @SuppressWarnings("deprecation")
+ Node n = NodeFactory.createLiteral(ll);
+ return new LiteralImpl( n, this );
}
/**
@@ -729,7 +741,9 @@
if (value instanceof Calendar)
return createTypedLiteral( (Calendar)value );
LiteralLabel ll = LiteralLabelFactory.createTypedLiteral( value );
- return new LiteralImpl( NodeFactory.createLiteral( ll ), this);
+ @SuppressWarnings("deprecation")
+ Node n = NodeFactory.createLiteral(ll);
+ return new LiteralImpl( n, this );
}
@Override
diff --git a/jena-core/src/main/java/org/apache/jena/rdf/model/impl/StatementBase.java b/jena-core/src/main/java/org/apache/jena/rdf/model/impl/StatementBase.java
index 7c80364..8bd866f 100644
--- a/jena-core/src/main/java/org/apache/jena/rdf/model/impl/StatementBase.java
+++ b/jena-core/src/main/java/org/apache/jena/rdf/model/impl/StatementBase.java
@@ -51,15 +51,17 @@
* LiteralRequiredException.
*/
public abstract Literal getLiteral();
-
+
public abstract Resource getResource();
-
+
public abstract Resource getSubject();
-
+
public abstract Property getPredicate();
-
+
public abstract RDFNode getObject();
+ /** @deprecated To be removed: Argument 'wellFormed is ignored */
+ @Deprecated
protected StatementImpl stringReplace(String s, String lang, boolean wellFormed) {
return replace(new LiteralImpl(NodeFactory.createLiteral(s, lang, wellFormed), model));
}
@@ -75,7 +77,7 @@
public Statement changeLiteralObject( boolean o )
{ return changeObject( model.createTypedLiteral( o ) ); }
-
+
public Statement changeLiteralObject( long o )
{ return changeObject( model.createTypedLiteral( o ) ); }
@@ -84,24 +86,28 @@
public Statement changeLiteralObject( double o )
{ return changeObject( model.createTypedLiteral( o ) ); }
-
+
public Statement changeLiteralObject( float o )
{ return changeObject( model.createTypedLiteral( o ) ); }
-
+
public Statement changeLiteralObject( int o )
{ return changeObject( model.createTypedLiteral( o ) ); }
public Statement changeObject( String o )
{ return stringReplace( String.valueOf( o ) ); }
+ /** @deprecated To be removed: Argument 'wellFormed is ignored */
+ @Deprecated
public Statement changeObject( String o, boolean wellFormed )
{ return stringReplace( String.valueOf( o ), "", wellFormed ); }
public Statement changeObject( String o, String l )
{ return stringReplace( String.valueOf( o ), l, false ); }
+ /** @deprecated To be removed: Argument 'wellFormed is ignored */
+ @Deprecated
public Statement changeObject( String o, String l, boolean wellFormed )
- { return stringReplace( String.valueOf( o ), l, wellFormed ); }
+ { return stringReplace( String.valueOf( o ), l, wellFormed ); }
public Statement changeObject( RDFNode o )
{ return replace( o ); }
@@ -147,23 +153,31 @@
public String getLanguage()
{ return getLiteral().getLanguage(); }
+ /**
+ * @deprecated To be removed. Well-formedness of XML literal is not tested for.
+ */
+ @Deprecated
public boolean getWellFormed()
{ return hasWellFormedXML(); }
-
+
+ /**
+ * @deprecated To be removed. Well-formness of XML literal is not tested for.
+ */
+ @Deprecated
public boolean hasWellFormedXML()
{ return getLiteral().isWellFormedXML(); }
/**
- Answer a string describing this Statement in a vaguely pretty way, with the
+ Answer a string describing this Statement in a vaguely pretty way, with the
representations of the subject, predicate, and object in that order.
*/
@Override
public String toString()
{
return
- "["
+ "["
+ getSubject().toString()
- + ", " + getPredicate().toString()
+ + ", " + getPredicate().toString()
+ ", " + objectString( getObject() )
+ "]";
}
diff --git a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/RDFXMLReader.java b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/RDFXMLReader.java
index e4f4719..e1ccf8c 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/RDFXMLReader.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/RDFXMLReader.java
@@ -135,6 +135,7 @@
}
}
+ @SuppressWarnings("deprecation")
private static Node convert(ALiteral lit) {
String dtURI = lit.getDatatypeURI();
if (dtURI == null)
diff --git a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput0/RDFXMLReader0.java b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput0/RDFXMLReader0.java
index d942af1..fcdc761 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput0/RDFXMLReader0.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput0/RDFXMLReader0.java
@@ -120,6 +120,7 @@
}
}
+ @SuppressWarnings("deprecation")
private static Node convert(ALiteral lit) {
String dtURI = lit.getDatatypeURI();
if (dtURI == null)
diff --git a/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/RDFXML_Basic.java b/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/RDFXML_Basic.java
index 43ee47c..5655392 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/RDFXML_Basic.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/RDFXML_Basic.java
@@ -26,15 +26,15 @@
/** Writes out an XML serialization of a model.
*/
-public class RDFXML_Basic extends BaseXMLWriter
+public class RDFXML_Basic extends BaseXMLWriter
{
- public RDFXML_Basic()
+ public RDFXML_Basic()
{}
-
+
private String space;
-
+
@Override protected void writeBody
- ( Model model, PrintWriter pw, String base, boolean inclXMLBase )
+ ( Model model, PrintWriter pw, String base, boolean inclXMLBase )
{
setSpaceFromTabCount();
writeRDFHeader( model, pw );
@@ -48,11 +48,11 @@
space = "";
for (int i=0; i < tabSize; i += 1) space += " ";
}
-
+
protected void writeSpace( PrintWriter writer )
{ writer.print( space ); }
- private void writeRDFHeader(Model model, PrintWriter writer)
+ private void writeRDFHeader(Model model, PrintWriter writer)
{
String xmlns = xmlnsDecl();
writer.print( "<" + rdfEl( "RDF" ) + xmlns );
@@ -67,7 +67,7 @@
while (rIter.hasNext()) writeRDFStatements( model, rIter.nextResource(), writer );
}
- protected void writeRDFTrailer( PrintWriter writer, String base )
+ protected void writeRDFTrailer( PrintWriter writer, String base )
{ writer.println( "</" + rdfEl( "RDF" ) + ">" ); }
protected void writeRDFStatements
@@ -96,7 +96,7 @@
+ startElementTag(
predicate.getNameSpace(),
predicate.getLocalName()));
-
+
if (object instanceof Resource) {
writer.print(" ");
writeResourceReference(((Resource) object), writer);
@@ -111,12 +111,12 @@
+ ">");
}
}
-
- @Override protected void unblockAll()
+
+ @Override protected void unblockAll()
{ blockLiterals = false; }
-
+
private boolean blockLiterals = false;
-
+
@Override protected void blockRule( Resource r ) {
if (r.equals( RDFSyntax.parseTypeLiteralPropertyElt )) {
blockLiterals = true;
@@ -124,10 +124,10 @@
logger.warn("Cannot block rule <"+r.getURI()+">");
}
- protected void writeDescriptionTrailer( Resource subject, PrintWriter writer )
+ protected void writeDescriptionTrailer( Resource subject, PrintWriter writer )
{ writer.println( space + "</" + rdfEl( "Description" ) + ">" ); }
-
-
+
+
protected void writeResourceId( Resource r, PrintWriter writer )
{
if (r.isAnon()) {
@@ -152,7 +152,8 @@
}
}
- protected void writeLiteral( Literal l, PrintWriter writer ) {
+ @SuppressWarnings("deprecation")
+ protected void writeLiteral( Literal l, PrintWriter writer ) {
String lang = l.getLanguage();
String form = l.getLexicalForm();
if (Util.isLangString(l)) {
@@ -163,9 +164,9 @@
writer.print( form );
return ;
} else {
- // Datatype (if not xsd:string and RDF 1.1)
+ // Datatype (if not xsd:string and RDF 1.1)
String dt = l.getDatatypeURI();
- if ( ! Util.isSimpleString(l) )
+ if ( ! Util.isSimpleString(l) )
writer.print( " " + rdfAt( "datatype" ) + "=" + substitutedAttribute( dt ) );
}
// Content.
diff --git a/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/Unparser.java b/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/Unparser.java
index d93372c..f395e2b 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/Unparser.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/Unparser.java
@@ -426,6 +426,7 @@
* [6.12.2] propertyElt ::= '<' propName idAttr? parseLiteral '>' literal '</'
* propName '>'
*/
+ @SuppressWarnings("deprecation")
private boolean wPropertyEltLiteral(WType wt, Property prop, Statement s,
RDFNode r) {
if (prettyWriter.sParseTypeLiteralPropertyElt)
diff --git a/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/Util.java b/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/Util.java
index 86f7a81..450f4cc 100755
--- a/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/Util.java
+++ b/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/Util.java
@@ -117,13 +117,13 @@
if ( num1 instanceof BigDecimal && num2 instanceof BigDecimal ) {
BigDecimal dec1 = (BigDecimal)num1;
BigDecimal dec2 = (BigDecimal)num2;
- return dec1.compareTo(dec2);
+ return dec1.compareTo(dec2);
}
// Both BigInteger
if ( num1 instanceof BigInteger && num2 instanceof BigInteger ) {
BigInteger int1 = (BigInteger)num1;
BigInteger int2 = (BigInteger)num2;
- return int1.compareTo(int2);
+ return int1.compareTo(int2);
}
// Mixed. Includes comparing BigInteger and BigDecimal and comparing
@@ -132,7 +132,7 @@
BigDecimal dec2 = convertToBigDecimal(num2);
return dec1.compareTo(dec2);
}
-
+
private static BigDecimal convertToBigDecimal(Number num) {
if ( num instanceof BigDecimal )
return (BigDecimal)num ;
@@ -261,25 +261,31 @@
* Construct a new integer valued node
*/
public static Node makeIntNode(int value) {
- return NodeFactory.createLiteral(LiteralLabelFactory.createTypedLiteral( value ));
+ LiteralLabel ll = LiteralLabelFactory.createTypedLiteral( value );
+ @SuppressWarnings("deprecation")
+ Node n = NodeFactory.createLiteral(ll);
+ return n;
}
/**
* Construct a new long valued node
*/
public static Node makeLongNode(long value) {
- if (value > Integer.MAX_VALUE) {
- return NodeFactory.createLiteral(LiteralLabelFactory.createTypedLiteral( value ));
- } else {
- return NodeFactory.createLiteral(LiteralLabelFactory.createTypedLiteral( (int) value ));
- }
+ @SuppressWarnings("deprecation")
+ Node n = (value > Integer.MAX_VALUE)
+ ? NodeFactory.createLiteral(LiteralLabelFactory.createTypedLiteral( value ))
+ : NodeFactory.createLiteral(LiteralLabelFactory.createTypedLiteral( (int) value ));
+ return n;
}
/**
* Construct a new double valued node
*/
public static Node makeDoubleNode(double value) {
- return NodeFactory.createLiteral(LiteralLabelFactory.createTypedLiteral( value ));
+ LiteralLabel ll = LiteralLabelFactory.createTypedLiteral( value );
+ @SuppressWarnings("deprecation")
+ Node n = NodeFactory.createLiteral(ll);
+ return n;
}
/**
diff --git a/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/builtins/Now.java b/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/builtins/Now.java
index 6a9ee40..b2319d4 100644
--- a/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/builtins/Now.java
+++ b/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/builtins/Now.java
@@ -33,14 +33,14 @@
public class Now extends BaseBuiltin {
/**
- * Return a name for this builtin, normally this will be the name of the
+ * Return a name for this builtin, normally this will be the name of the
* functor that will be used to invoke it.
*/
@Override
public String getName() {
return "now";
}
-
+
/**
* Return the expected number of arguments for this functor or 0 if the number is flexible.
*/
@@ -51,7 +51,7 @@
/**
* This method is invoked when the builtin is called in a rule body.
- * @param args the array of argument values for the builtin, this is an array
+ * @param args the array of argument values for the builtin, this is an array
* of Nodes, some of which may be Node_RuleVariables.
* @param context an execution context giving access to other relevant data
* @return return true if the buildin predicate is deemed to have succeeded in
@@ -61,6 +61,7 @@
public boolean bodyCall(Node[] args, int length, RuleContext context) {
checkArgs(length, context);
BindingEnvironment env = context.getEnv();
+ @SuppressWarnings("deprecation")
Node now = NodeFactory.createLiteral( LiteralLabelFactory.createTypedLiteral(new XSDDateTime(Calendar.getInstance())) );
return env.bind(args[0], now);
}
diff --git a/jena-core/src/test/java/org/apache/jena/graph/GraphContractTest.java b/jena-core/src/test/java/org/apache/jena/graph/GraphContractTest.java
index 4cfb19a..cc0abab 100644
--- a/jena-core/src/test/java/org/apache/jena/graph/GraphContractTest.java
+++ b/jena-core/src/test/java/org/apache/jena/graph/GraphContractTest.java
@@ -806,12 +806,16 @@
Graph g = producer.newInstance();
if (g.getCapabilities().handlesLiteralTyping())
{
+ @SuppressWarnings("deprecation")
Node ab = NodeFactory.createLiteral(LiteralLabelFactory
.createTypedLiteral(Byte.valueOf((byte) 42)));
+ @SuppressWarnings("deprecation")
Node as = NodeFactory.createLiteral(LiteralLabelFactory
.createTypedLiteral(Short.valueOf((short) 42)));
+ @SuppressWarnings("deprecation")
Node ai = NodeFactory.createLiteral(
LiteralLabelFactory.createTypedLiteral(Integer.valueOf(42)));
+ @SuppressWarnings("deprecation")
Node al = NodeFactory.createLiteral(
LiteralLabelFactory.createTypedLiteral(Long.valueOf(42)));
@@ -941,12 +945,16 @@
Graph g = producer.newInstance();
if (g.getCapabilities().handlesLiteralTyping())
{
- Node ab = NodeFactory.createLiteral(LiteralLabelFactory
+ @SuppressWarnings("deprecation")
+ Node ab = NodeFactory.createLiteral(LiteralLabelFactory
.createTypedLiteral(Byte.valueOf((byte) 42)));
+ @SuppressWarnings("deprecation")
Node as = NodeFactory.createLiteral(LiteralLabelFactory
.createTypedLiteral(Short.valueOf((short) 42)));
+ @SuppressWarnings("deprecation")
Node ai = NodeFactory.createLiteral(
LiteralLabelFactory.createTypedLiteral(Integer.valueOf(42)));
+ @SuppressWarnings("deprecation")
Node al = NodeFactory.createLiteral(
LiteralLabelFactory.createTypedLiteral(Long.valueOf(42)));
diff --git a/jena-core/src/test/java/org/apache/jena/graph/test/NodeCreateUtils.java b/jena-core/src/test/java/org/apache/jena/graph/test/NodeCreateUtils.java
index c1ec4f6..7abb9cc 100644
--- a/jena-core/src/test/java/org/apache/jena/graph/test/NodeCreateUtils.java
+++ b/jena-core/src/test/java/org/apache/jena/graph/test/NodeCreateUtils.java
@@ -37,7 +37,7 @@
/**
Returns a Node described by the string, primarily for testing purposes.
The string represents a URI, a numeric literal, a string literal, a bnode label,
- or a variable.
+ or a variable.
<ul>
<li> 'some text' :: a string literal with that text
<li> 'some text'someLanguage:: a string literal with that text and language
@@ -53,11 +53,11 @@
*/
public static Node create( String x )
{ return create( PrefixMapping.Extended, x ); }
-
+
/**
Returns a Node described by the string, primarily for testing purposes.
The string represents a URI, a numeric literal, a string literal, a bnode label,
- or a variable.
+ or a variable.
<ul>
<li> 'some text' :: a string literal with that text
<li> 'some text'someLanguage:: a string literal with that text and language
@@ -68,11 +68,12 @@
<li> &PPP :: to be done
<li> name:stuff :: the URI; name may be expanded using the Extended map
</ul>
-
+
@param pm the PrefixMapping for translating pre:X strings
@param x the string encoding the node to create
@return a node with the appropriate type and label
*/
+ @SuppressWarnings("deprecation")
public static Node create( PrefixMapping pm, String x )
{
if (x.equals( "" ))
@@ -80,7 +81,7 @@
char first = x.charAt( 0 );
if (first == '\'' || first == '\"')
return NodeFactory.createLiteral( newString( pm, first, x ) );
- if (Character.isDigit( first ))
+ if (Character.isDigit( first ))
return NodeFactory.createLiteral( x, XSDDatatype.XSDinteger );
if (first == '_')
return NodeFactory.createBlankNode( BlankNodeId.create( x ) );
@@ -89,10 +90,10 @@
if (first == '?')
return NodeFactory.createVariable( x.substring( 1 ) );
if (first == '&')
- return NodeFactory.createURI( "q:" + x.substring( 1 ) );
+ return NodeFactory.createURI( "q:" + x.substring( 1 ) );
int colon = x.indexOf( ':' );
String d = pm.getNsPrefixURI( "" );
- return colon < 0
+ return colon < 0
? NodeFactory.createURI( (d == null ? "eh:/" : d) + x )
: NodeFactory.createURI( pm.expandPrefix( x ) )
;
@@ -114,7 +115,7 @@
result.append( spelling.substring( start ) );
return result.toString();
}
-
+
private static char unEscape( char ch )
{
switch (ch)
@@ -133,7 +134,7 @@
{
String content = unEscape( spelling );
int colon = langOrType.indexOf( ':' );
- return colon < 0
+ return colon < 0
? LiteralLabelFactory.create( content, langOrType, false )
: LiteralLabelFactory.create( content, NodeFactory.getType( pm.expandPrefix( langOrType ) ) )
;
@@ -164,7 +165,7 @@
details of the supported syntax. This method exists to support test code.
Nodes are interpreted using the Standard prefix mapping.
*/
-
+
public static Triple createTriple( String fact )
{ return createTriple( PrefixMapping.Standard, fact ); }
}
diff --git a/jena-core/src/test/java/org/apache/jena/graph/test/TestFindLiterals.java b/jena-core/src/test/java/org/apache/jena/graph/test/TestFindLiterals.java
index bbe93e9..5d94d08 100644
--- a/jena-core/src/test/java/org/apache/jena/graph/test/TestFindLiterals.java
+++ b/jena-core/src/test/java/org/apache/jena/graph/test/TestFindLiterals.java
@@ -32,19 +32,19 @@
{
public TestFindLiterals( String name )
{ super( name ); }
-
+
public static TestFindLiterals aTest
( final String graph, final int size, final String search, final String results )
{
return new TestFindLiterals
- ( "TestFindLiterals: graph {" + graph
- + "} size " + size
- + " search " + search
+ ( "TestFindLiterals: graph {" + graph
+ + "} size " + size
+ + " search " + search
+ " expecting {" + results + "}" )
{
@Override
public void runBare()
- {
+ {
Graph g = graphWith( graph );
Node literal = NodeCreateUtils.create( search );
//
@@ -54,10 +54,10 @@
}
};
}
-
+
public static TestSuite suite()
- {
- TestSuite result = new TestSuite( TestFindLiterals.class );
+ {
+ TestSuite result = new TestSuite( TestFindLiterals.class );
//
result.addTest( aTest( "a P 'simple'", 1, "'simple'", "'simple'" ) );
result.addTest( aTest( "a P 'simple'xsd:string", 1, "'simple'", "'simple'xsd:string" ) );
@@ -77,7 +77,7 @@
//
result.addTest( aTest( "a P 'abc'rdf:XMLLiteral", 1, "'abc'", "" ) );
result.addTest( aTest( "a P 'abc'", 1, "'abc'rdf:XMLLiteral", "" ) );
- //
+ //
// floats & doubles are not compatible
//
result.addTest( aTest( "a P '1'xsd:float", 1, "'1'xsd:double", "" ) );
@@ -89,8 +89,8 @@
result.addTest( aTest( "a P '1'xsd:short", 1, "'1'xsd:integer", "'1'xsd:short" ) );
result.addTest( aTest( "a P '1'xsd:int", 1, "'1'xsd:integer", "'1'xsd:int" ) );
return result;
- }
-
+ }
+
public void testFloatVsDouble()
{
Node A = NodeCreateUtils.create( "'1'xsd:float" );
@@ -101,8 +101,9 @@
assertFalse( A.matches( B ) );
assertFalse( B.matches( A ) );
}
-
- public void testProgrammaticValues()
+
+ @SuppressWarnings("deprecation")
+ public void testProgrammaticValues()
{
Node ab = NodeFactory.createLiteral( LiteralLabelFactory.createTypedLiteral( (byte) 42 ) );
Node as = NodeFactory.createLiteral( LiteralLabelFactory.createTypedLiteral( (short) 42 ) );
diff --git a/jena-core/src/test/java/org/apache/jena/graph/test/TestNode.java b/jena-core/src/test/java/org/apache/jena/graph/test/TestNode.java
index dc28346..c8eb15e 100644
--- a/jena-core/src/test/java/org/apache/jena/graph/test/TestNode.java
+++ b/jena-core/src/test/java/org/apache/jena/graph/test/TestNode.java
@@ -39,12 +39,12 @@
and that the test predicates work properly on the different node kinds.
*/
public class TestNode extends GraphTestBase
-{
+{
public TestNode( String name )
{ super( name ); }
public static TestSuite suite()
- { return new TestSuite( TestNode.class ); }
+ { return new TestSuite( TestNode.class ); }
private static final String U = "http://some.domain.name/magic/spells.incant";
private static final String N = "Alice";
@@ -60,6 +60,7 @@
assertEquals( "anonymous nodes have the right id", NodeFactory.createBlankNode(A).getBlankNodeId(), A );
}
+ @SuppressWarnings("deprecation")
public void testLiterals()
{
assertFalse( "literal nodes aren't blank", NodeFactory.createLiteral( L ).isBlank() );
@@ -81,7 +82,7 @@
public void testVariables()
{
assertFalse( "variable nodes aren't blank", NodeFactory.createVariable( N ).isBlank() );
- assertFalse( "variable nodes aren't literal", NodeFactory.createVariable( N ).isLiteral() );
+ assertFalse( "variable nodes aren't literal", NodeFactory.createVariable( N ).isLiteral() );
assertFalse( "variable nodes aren't URIs", NodeFactory.createVariable( N ).isURI() );
assertTrue( "variable nodes are variable", NodeFactory.createVariable( N ).isVariable() );
assertEquals( "variable nodes keep their name", N, NodeFactory.createVariable( N ).getName() );
@@ -111,8 +112,9 @@
making a special class for these pairs.] The nodes are created with caching
off, to make sure that caching effects don't hide the effect of using .equals().
The strings are "equality groups": the nodes should test equal iff their
- associated strings test equal.
+ associated strings test equal.
*/
+ @SuppressWarnings("deprecation")
private Object [][] eqTestCases()
{
BlankNodeId id = BlankNodeId.create();
@@ -145,7 +147,7 @@
};
}
- public void testNodeEquals()
+ public void testNodeEquals()
{
Object [][] tests = eqTestCases();
for ( Object[] I : tests )
@@ -174,6 +176,7 @@
return fullName.substring( fullName.lastIndexOf( '.' ) + 1 );
}
+ @SuppressWarnings("deprecation")
public void testEquals()
{
assertDiffer( "different variables", NodeFactory.createVariable( "xx" ), NodeFactory.createVariable( "yy" ) );
@@ -191,6 +194,7 @@
test that the label of a Node can be retrieved from that Node in
a way appropriate to that Node.
*/
+ @SuppressWarnings("deprecation")
public void testLabels()
{
BlankNodeId id = BlankNodeId.create();
@@ -202,8 +206,9 @@
/**
this is where we test that using the wrong accessor on a Node gets you
- an exception.
+ an exception.
*/
+ @SuppressWarnings("deprecation")
public void testFailingLabels()
{
Node u = NodeFactory.createURI( U ), b = NodeFactory.createBlankNode();
@@ -258,7 +263,7 @@
assertDiffer( Node_Variable.variable( "aaa" ), Node_Variable.variable( "yyy" ) );
}
- /**
+ /**
Test that the create method does sensible things on null and ""
*/
public void testCreateBadString()
@@ -299,14 +304,14 @@
{
Node n = NodeCreateUtils.create( "'xxx'" );
assertEquals( "xxx", n.getLiteralLexicalForm() );
- assertString(n);
+ assertString(n);
}
public void testCreatePlainLiteralDoubleQuotes()
{
Node n = NodeCreateUtils.create( "\"xxx\"" );
assertEquals( "xxx", n.getLiteralLexicalForm() );
- assertString(n);
+ assertString(n);
}
public void testCreateLiteralBackslashEscape()
@@ -341,9 +346,9 @@
{
Node n = NodeCreateUtils.create( "'chat'en-UK" );
assertEquals( "chat", n.getLiteralLexicalForm() );
- assertLangString(n);
+ assertLangString(n);
assertEquals( "en-UK", n.getLiteralLanguage() );
- }
+ }
public void testCreateLanguagedLiteralEN2()
{
@@ -351,7 +356,7 @@
Node n2 = NodeCreateUtils.create( "'chat'EN-UK" );
assertTrue( n1.sameValueAs(n2) ) ;
assertFalse( n1.equals(n2) ) ;
- }
+ }
public void testCreateLanguagedLiteralXY()
{
@@ -450,7 +455,7 @@
String prefix = "spoo", ns = "abc:def/ghi#";
pm.setNsPrefix( prefix, ns );
String suffix = "bamboozle";
- assertEquals( prefix + ":" + suffix, NodeCreateUtils.create( ns + suffix ).toString( pm ) );
+ assertEquals( prefix + ":" + suffix, NodeCreateUtils.create( ns + suffix ).toString( pm ) );
}
public void testNodeHelp()
@@ -464,7 +469,7 @@
public void testVisitorPatternNode()
{
- NodeVisitor returnNode = new NodeVisitor()
+ NodeVisitor returnNode = new NodeVisitor()
{
@Override
public Object visitAny( Node_ANY it ) { return it; }
@@ -490,16 +495,16 @@
private void testVisitorPatternNode( String ns, NodeVisitor v )
{
- Node n = node( ns );
- assertEquals( n, n.visitWith( v ) );
+ Node n = node( ns );
+ assertEquals( n, n.visitWith( v ) );
}
private void visitExamples( NodeVisitor nv )
- {
- node( "sortOfURI" ).visitWith( nv );
- node( "?variableI" ).visitWith( nv );
- node( "_anon" ).visitWith( nv );
- node( "11" ).visitWith( nv );
+ {
+ node( "sortOfURI" ).visitWith( nv );
+ node( "?variableI" ).visitWith( nv );
+ node( "_anon" ).visitWith( nv );
+ node( "11" ).visitWith( nv );
node( "??" ).visitWith( nv );
// ---
Node s = node( "uri1" );
@@ -515,22 +520,22 @@
public void testVisitorPatternValue()
{
- NodeVisitor checkValue = new NodeVisitor()
+ NodeVisitor checkValue = new NodeVisitor()
{
@Override
- public Object visitAny( Node_ANY it )
+ public Object visitAny( Node_ANY it )
{ return null; }
@Override
- public Object visitBlank( Node_Blank it, BlankNodeId id )
+ public Object visitBlank( Node_Blank it, BlankNodeId id )
{ assertTrue( it.getBlankNodeId() == id ); return null; }
@Override
- public Object visitLiteral( Node_Literal it, LiteralLabel lit )
+ public Object visitLiteral( Node_Literal it, LiteralLabel lit )
{ assertTrue( it.getLiteral() == lit ); return null; }
@Override
- public Object visitURI( Node_URI it, String uri )
+ public Object visitURI( Node_URI it, String uri )
{ assertTrue( it.getURI() == uri ); return null; }
@Override
- public Object visitVariable( Node_Variable it, String name )
+ public Object visitVariable( Node_Variable it, String name )
{ assertEquals( it.getName(), name ); return null; }
@Override
public Object visitTriple(Node_Triple it, Triple triple)
@@ -549,22 +554,22 @@
public void testVisitorPatternCalled()
{
final String [] strings = new String [] { "" };
- NodeVisitor checkCalled = new NodeVisitor()
+ NodeVisitor checkCalled = new NodeVisitor()
{
@Override
- public Object visitAny( Node_ANY it )
+ public Object visitAny( Node_ANY it )
{ strings[0] += " any"; return null; }
@Override
- public Object visitBlank( Node_Blank it, BlankNodeId id )
+ public Object visitBlank( Node_Blank it, BlankNodeId id )
{ strings[0] += " blank"; return null; }
@Override
- public Object visitLiteral( Node_Literal it, LiteralLabel lit )
+ public Object visitLiteral( Node_Literal it, LiteralLabel lit )
{ strings[0] += " literal"; return null; }
@Override
- public Object visitURI( Node_URI it, String uri )
+ public Object visitURI( Node_URI it, String uri )
{ strings[0] += " uri"; return null; }
@Override
- public Object visitVariable( Node_Variable it, String name )
+ public Object visitVariable( Node_Variable it, String name )
{ strings[0] += " variable"; return null; }
@Override
public Object visitTriple(Node_Triple it, Triple triple)
@@ -574,7 +579,7 @@
{ strings[0] += " termGraph"; return null; }
};
- String desired = " uri variable blank literal any termTriple termGraph";
+ String desired = " uri variable blank literal any termTriple termGraph";
visitExamples( checkCalled );
assertEquals( "all visits must have been made", desired, strings[0] );
}
@@ -612,7 +617,7 @@
{
TypeMapper tm = TypeMapper.getInstance();
RDFDatatype dtInt = tm.getTypeByValue( Integer.valueOf( 10 ) );
- Node plain = NodeFactory.createLiteral( "rhubarb", "");
+ Node plain = NodeFactory.createLiteral( "rhubarb", "");
Node english = NodeFactory.createLiteral( "eccentric", "en_UK");
Node typed = NodeFactory.createLiteral( "10", dtInt );
assertEquals( "\"rhubarb\"", plain.toString() );
@@ -652,22 +657,22 @@
public void testGetIndexingValueBase64Binary1()
{ testIndexingValueLiteral( ()->NodeCreateUtils.create( "''xsd:base64Binary" ) ); }
- // "sure." encodes to "c3VyZS4="
+ // "sure." encodes to "c3VyZS4="
public void testGetIndexingValueBase64Binary2()
{ testIndexingValueLiteral( ()->NodeCreateUtils.create( "'c3VyZS4='xsd:base64Binary" ) ); }
-
+
private void testIndexingValueLiteral( Creator<Node> creator) {
Node n1 = creator.create();
Node n2 = creator.create();
testIndexingValueLiteral(n1,n2);
}
-
+
private void testIndexingValueLiteral(Node n1, Node n2) {
assertNotSame(n1, n2); // Test the test.
assertEquals(n1.getLiteral().getIndexingValue(), n2.getIndexingValue());
assertEquals(n1.getLiteral().getIndexingValue().hashCode(), n2.getIndexingValue().hashCode());
}
-
+
public void testGetLiteralValuePlainString()
{
Node s = NodeCreateUtils.create( "'aString'" );
@@ -679,6 +684,7 @@
assertString(NodeCreateUtils.create( "'plain'" )) ;
}
+ @SuppressWarnings("deprecation")
public void testLiteralIsXML()
{
assertFalse( NodeCreateUtils.create( "'notXML'" ).getLiteralIsXML() );
@@ -698,7 +704,7 @@
assertFalse( NodeCreateUtils.create( "?x" ).isConcrete() );
}
- static String [] someURIs = new String []
+ static String [] someURIs = new String []
{
"http://domainy.thing/stuff/henry",
"http://whatever.com/stingy-beast/bee",
@@ -742,7 +748,7 @@
}
}
- protected void testHasURI( String uri )
+ protected void testHasURI( String uri )
{
Node n = NodeCreateUtils.create( uri );
assertTrue( uri, !n.isURI() || n.hasURI( uri ) );
diff --git a/jena-core/src/test/java/org/apache/jena/graph/test/TestTriple.java b/jena-core/src/test/java/org/apache/jena/graph/test/TestTriple.java
index ed9d93b..a2bf1e2 100644
--- a/jena-core/src/test/java/org/apache/jena/graph/test/TestTriple.java
+++ b/jena-core/src/test/java/org/apache/jena/graph/test/TestTriple.java
@@ -31,18 +31,18 @@
import org.apache.jena.shared.PrefixMapping ;
public class TestTriple extends GraphTestBase
- {
-
+ {
+
public TestTriple(String name)
{ super( name ); }
-
+
public static TestSuite suite()
- { return new TestSuite( TestTriple.class ); }
-
+ { return new TestSuite( TestTriple.class ); }
+
private static final String U = "http://some.domain.name/magic/spells.incant";
private static final String N = "Alice";
private static final LiteralLabel L = LiteralLabelFactory.create( "ashes are burning", "en", false );
-
+
public void testTripleEquals() {
// create some nodes to test
BlankNodeId id = BlankNodeId.create();
@@ -50,6 +50,7 @@
String U2 = id.toString();
String N2 = id.toString();
+ @SuppressWarnings("deprecation")
Node[] nodes = new Node[] {
Node.ANY,
NodeFactory.createBlankNode(id), NodeFactory.createBlankNode(),
@@ -58,7 +59,7 @@
NodeFactory.createVariable(N), NodeFactory.createVariable(N2)
};
- Triple[] triples =
+ Triple[] triples =
new Triple [nodes.length * nodes.length * nodes.length];
for (int i=0; i<nodes.length; i++) {
for (int j=0; j<nodes.length; j++) {
@@ -112,19 +113,19 @@
}
}
}
-
+
public void testTripleCreate()
{
Node S = NodeCreateUtils.create( "s" ), P = NodeCreateUtils.create( "p" ), O = NodeCreateUtils.create( "o" );
assertEquals( Triple.create( S, P, O ), Triple.create( S, P, O ) );
}
-
+
public void testTripleCreateFromString()
{
Node S = NodeCreateUtils.create( "a" ), P = NodeCreateUtils.create( "_P" ), O = NodeCreateUtils.create( "?c" );
assertEquals( Triple.create( S, P, O ), NodeCreateUtils.createTriple( "a _P ?c") );
}
-
+
/**
Test that triple-creation respects prefixes, assuming that node creation
does.
@@ -136,7 +137,7 @@
Triple t = NodeCreateUtils.createTriple( "rdf:alpha dc:creator spoo:notmapped" );
assertEquals( Triple.create( S, P, O ), t );
}
-
+
public void testTripleCreationMapped()
{
PrefixMapping pm = PrefixMapping.Factory.create()
@@ -147,14 +148,14 @@
Triple got = NodeCreateUtils.createTriple( pm, "a:x b:y c:z" );
assertEquals( wanted, got );
}
-
+
public void testPlainTripleMatches()
{
testMatches( "S P O" );
testMatches( "_S _P _O" );
testMatches( "1 2 3" );
}
-
+
public void testAnyTripleMatches()
{
testMatches( "?? P O", "Z P O" );
@@ -165,30 +166,30 @@
testMatches( "?? ?? ??", "_X Y Z" );
testMatches( "?? ?? ??", "X _Y Z" );
}
-
+
private void testMatches( String triple )
{ testMatches( triple, triple ); }
-
+
private void testMatches( String pattern, String triple )
{ assertTrue( NodeCreateUtils.createTriple( pattern ).matches( NodeCreateUtils.createTriple( triple ) ) ); }
-
+
public void testPlainTripleDoesntMatch()
{
testMatchFails( "S P O", "Z P O" );
testMatchFails( "S P O", "S Q O" );
testMatchFails( "S P O", "S P oh" );
}
-
+
public void testAnyTripleDoesntMatch()
{
testMatchFails( "?? P O", "S P oh" );
testMatchFails( "S ?? O", "Z R O" );
testMatchFails( "S P ??", "Z P oh" );
}
-
+
public void testMatchFails( String pattern, String triple )
{ assertFalse( NodeCreateUtils.createTriple( pattern ).matches( NodeCreateUtils.createTriple( triple ) ) ); }
-
+
public void testMatchesNodes()
{
assertTrue( NodeCreateUtils.createTriple( "S P O" ).matches( node("S" ), node( "P" ), node( "O" ) ) );
@@ -198,9 +199,9 @@
/* */
assertFalse( NodeCreateUtils.createTriple( "S P O" ).matches( node("Z" ), node( "P" ), node( "O" ) ) );
assertFalse( NodeCreateUtils.createTriple( "S P O" ).matches( node("S" ), node( "Q" ), node( "O" ) ) );
- assertFalse( NodeCreateUtils.createTriple( "S P O" ).matches( node("Z" ), node( "P" ), node( "I" ) ) );
+ assertFalse( NodeCreateUtils.createTriple( "S P O" ).matches( node("Z" ), node( "P" ), node( "I" ) ) );
}
-
+
public void testElementMatches()
{
assertTrue( NodeCreateUtils.createTriple( "S P O" ).subjectMatches( node( "S" ) ) );
@@ -209,13 +210,13 @@
/* */
assertFalse( NodeCreateUtils.createTriple( "S P O" ).subjectMatches( node( "Z" ) ) );
assertFalse( NodeCreateUtils.createTriple( "S P O" ).predicateMatches( node( "Q" ) ) );
- assertFalse( NodeCreateUtils.createTriple( "S P O" ).objectMatches( node( "I" ) ) );
+ assertFalse( NodeCreateUtils.createTriple( "S P O" ).objectMatches( node( "I" ) ) );
/* */
assertTrue( NodeCreateUtils.createTriple( "?? P O" ).subjectMatches( node( "SUB" ) ) );
assertTrue( NodeCreateUtils.createTriple( "S ?? O" ).predicateMatches( node( "PRED" ) ) );
- assertTrue( NodeCreateUtils.createTriple( "S P ??" ).objectMatches( node( "OBJ" ) ) );
+ assertTrue( NodeCreateUtils.createTriple( "S P ??" ).objectMatches( node( "OBJ" ) ) );
}
-
+
public void testConcrete()
{
assertTrue( NodeCreateUtils.createTriple( "S P O" ).isConcrete() );
@@ -232,7 +233,7 @@
assertFalse( NodeCreateUtils.createTriple( "S ?P 11").isConcrete() );
assertFalse( NodeCreateUtils.createTriple( "S P ?O").isConcrete() );
}
-
+
/**
Primarily to make sure that literals get quoted and stuff comes out in some
kind of coherent order.
@@ -244,13 +245,13 @@
assertTrue( "subject must preceed predicate", t1.toString().indexOf( "subject" ) < t1.toString().indexOf( "predicate" ) );
assertTrue( "predicate must preceed object", t1.toString().indexOf( "predicate" ) < t1.toString().indexOf( "object" ) );
}
-
+
public void testTripleToStringQuoting()
{
Triple t1 = NodeCreateUtils.createTriple( "subject predicate 'object'" );
assertTrue( t1.toString().indexOf( "\"object\"") > 0 );
}
-
+
public void testTripleToStringWithPrefixing()
{
PrefixMapping pm = PrefixMapping.Factory.create();
@@ -258,14 +259,14 @@
Triple t1 = NodeCreateUtils.createTriple( "eg://domain.dom/spoo#a b c" );
assertEquals( "spoo:a @eh:/b eh:/c", t1.toString( pm ) );
}
-
+
public void testTripleMaps()
{
assertEquals( node( "x" ), getSubject.apply( NodeCreateUtils.createTriple( "x P z" ) ) );
assertEquals( node( "P" ), getPredicate.apply( NodeCreateUtils.createTriple( "x P z" ) ) );
assertEquals( node( "z" ), getObject.apply( NodeCreateUtils.createTriple( "x P z" ) ) );
}
-
+
public static final Function<Triple, Node> getSubject = t -> t.getSubject();
public static final Function<Triple, Node> getPredicate = t -> t.getPredicate();
public static final Function<Triple, Node> getObject = t -> t.getObject();
diff --git a/jena-core/src/test/java/org/apache/jena/graph/test/TestTypedLiterals.java b/jena-core/src/test/java/org/apache/jena/graph/test/TestTypedLiterals.java
index 3ebd920..9e0e8f0 100644
--- a/jena-core/src/test/java/org/apache/jena/graph/test/TestTypedLiterals.java
+++ b/jena-core/src/test/java/org/apache/jena/graph/test/TestTypedLiterals.java
@@ -81,6 +81,7 @@
/**
* Test the base functioning of unknown datatypes
*/
+ @SuppressWarnings("deprecation")
public void testUnknown() {
String typeURI = "urn:x-hp-dt:unknown";
String typeURI2 = "urn:x-hp-dt:unknown2";
@@ -130,6 +131,7 @@
/**
* Tests the base functioning of a user defined datatype
*/
+ @SuppressWarnings("deprecation")
public void testUserDef() {
// Register the user defined type for rationals
RDFDatatype rtype = RationalType.theRationalType;
diff --git a/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestLiteralImpl.java b/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestLiteralImpl.java
index 7ba31f6..c1cc19c 100644
--- a/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestLiteralImpl.java
+++ b/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestLiteralImpl.java
@@ -6,9 +6,9 @@
* 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.
@@ -148,8 +148,7 @@
public void testLiteralHasModel()
{
testLiteralHasModel(model, model.createLiteral("hello, world"));
- testLiteralHasModel(model, model.createLiteral("hello, world", "en-UK"));
- testLiteralHasModel(model, model.createLiteral("hello, world", true));
+ testLiteralHasModel(model, model.createLiteral("hello, world", "en-GB"));
testLiteralHasModel(model, model.createTypedLiteral("hello, world"));
testLiteralHasModel(model, model.createTypedLiteral(false));
testLiteralHasModel(model, model.createTypedLiteral(17));
diff --git a/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestStatements.java b/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestStatements.java
index 06126aa..b60bb29 100644
--- a/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestStatements.java
+++ b/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestStatements.java
@@ -6,9 +6,9 @@
* 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.
@@ -34,7 +34,8 @@
super(modelFactory, name);
}
- public void testHasWellFormedXML()
+ @SuppressWarnings("deprecation")
+ public void testHasWellFormedXML()
{
Assert.assertFalse(ModelHelper.statement("s P 1").hasWellFormedXML());
Assert.assertFalse(ModelHelper.statement("S P '<x>/x>'rdf:XMLLiteral")
diff --git a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/WGTestSuite.java b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/WGTestSuite.java
index 5d5e571..14f3eaa 100644
--- a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/WGTestSuite.java
+++ b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/WGTestSuite.java
@@ -48,16 +48,8 @@
static private void initResults() {
logging = true;
testResults = ModelFactory.createDefaultModel();
- jena2 = testResults.createResource(BASE_RESULTS_URI + "#jena2");
- jena2.addProperty(RDFS.comment,
- testResults.createLiteral(
- "<a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://jena.sourceforce.net/\">Jena2</a> is a" +
- " Semantic Web framework in Java" +
- " available from <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://www.sourceforce.net/projects/jena\">" +
- "sourceforge</a> CVS.",
- true)
- );
- jena2.addProperty(RDFS.label, "Jena2");
+ jena2 = testResults.createResource(BASE_RESULTS_URI + "#jena");
+ jena2.addProperty(RDFS.label, "Jena");
testResults.setNsPrefix("results", OWLResults.NS);
}
static void logResult(Resource test, int type) {
diff --git a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput0/WGTestSuite.java b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput0/WGTestSuite.java
index 5b3ec96..c9bfc30 100644
--- a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput0/WGTestSuite.java
+++ b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput0/WGTestSuite.java
@@ -49,16 +49,8 @@
static private void initResults() {
logging = true;
testResults = ModelFactory.createDefaultModel();
- jena2 = testResults.createResource(BASE_RESULTS_URI + "#jena2");
- jena2.addProperty(RDFS.comment,
- testResults.createLiteral(
- "<a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://jena.sourceforce.net/\">Jena2</a> is a" +
- " Semantic Web framework in Java" +
- " available from <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://www.sourceforce.net/projects/jena\">" +
- "sourceforge</a> CVS.",
- true)
- );
- jena2.addProperty(RDFS.label, "Jena2");
+ jena2 = testResults.createResource(BASE_RESULTS_URI + "#jena");
+ jena2.addProperty(RDFS.label, "Jena");
testResults.setNsPrefix("results", OWLResults.NS);
}
static void logResult(Resource test, int type) {
diff --git a/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/TestBugs.java b/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/TestBugs.java
index ccd5923..6672488 100644
--- a/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/TestBugs.java
+++ b/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/TestBugs.java
@@ -821,9 +821,10 @@
public boolean bodyCall(Node[] args, int length, RuleContext context) {
checkArgs(length, context);
BindingEnvironment env = context.getEnv();
- Triple t = Triple.create( NodeFactory.createBlankNode(),
- NodeFactory.createURI("http://jena.hpl.hp.com/example#"),
+ Triple t = Triple.create( NodeFactory.createBlankNode(),
+ NodeFactory.createURI("http://jena.hpl.hp.com/example#"),
NodeFactory.createBlankNode());
+ @SuppressWarnings("deprecation")
Node l = NodeFactory.createLiteral( LiteralLabelFactory.createTypedLiteral(t) );
return env.bind(args[0], l);
}
@@ -873,7 +874,7 @@
// System.out.println(" - " + i.next());
// }
// }
-
+
/**
* Potential problem in handling of maxCardinality(0) assertions in the
* presence of disjointness.
@@ -882,8 +883,8 @@
doTestmaxCard2(OntModelSpec.OWL_MEM_MINI_RULE_INF);
doTestmaxCard2(OntModelSpec.OWL_MEM_RULE_INF);
}
-
-
+
+
private void doTestmaxCard2(OntModelSpec spec) {
String NS = "http://jena.hpl.hp.com/eg#";
Model base = FileManager.getInternal().loadModelInternal("testing/reasoners/bugs/terrorism.owl");
diff --git a/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/WebOntTestHarness.java b/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/WebOntTestHarness.java
index 3bccf11..4347987 100644
--- a/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/WebOntTestHarness.java
+++ b/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/WebOntTestHarness.java
@@ -250,15 +250,7 @@
*/
public void initResults() {
testResults = ModelFactory.createDefaultModel();
- jena2 = testResults.createResource(BASE_RESULTS_URI + "#jena2");
- jena2.addProperty(RDFS.comment,
- testResults.createLiteral(
- "<a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://jena.sourceforce.net/\">Jena2</a> includes a rule-based inference engine for RDF processing, " +
- "supporting both forward and backward chaining rules. Its OWL rule set is designed to provide sound " +
- "but not complete instance resasoning for that fragment of OWL/Full limited to the OWL/lite vocabulary. In" +
- "particular it does not support unionOf/complementOf.",
- true)
- );
+ jena2 = testResults.createResource(BASE_RESULTS_URI + "#jena");
jena2.addProperty(RDFS.label, "Jena2");
testResults.setNsPrefix("results", OWLResults.NS);
}
diff --git a/jena-core/src/test/java/org/apache/jena/reasoner/test/TestCurrentRDFWG.java b/jena-core/src/test/java/org/apache/jena/reasoner/test/TestCurrentRDFWG.java
index 8fa7804..dd0dc0b 100644
--- a/jena-core/src/test/java/org/apache/jena/reasoner/test/TestCurrentRDFWG.java
+++ b/jena-core/src/test/java/org/apache/jena/reasoner/test/TestCurrentRDFWG.java
@@ -38,47 +38,39 @@
* Test the default RDFS reasoner against the current set of working group tests
*/
public class TestCurrentRDFWG extends ReasonerTestBase {
-
+
/** Location of the test file directory */
- public static final String TEST_DIR = "testing/wg20031010/";
-// public static final String TEST_DIR = "testing/wg/";
-
+ public static final String TEST_DIR = "testing/wg20031010/";
+// public static final String TEST_DIR = "testing/wg/";
+
/** The base URI for the results file */
public static String BASE_RESULTS_URI = "http://jena.sourceforge.net/data/rdf-results.rdf";
-
+
/** The model describing the results of the run */
Model testResults;
-
+
/** The resource which acts as a description for the Jena2 instance being tested */
Resource jena2;
-
+
protected static Logger logger = LoggerFactory.getLogger(TestCurrentRDFWG.class);
/**
* Boilerplate for junit
- */
+ */
public TestCurrentRDFWG( String name ) {
- super( name );
+ super( name );
}
-
- /**
+
+ /**
* Initialize the result model.
*/
public void initResults() {
testResults = ModelFactory.createDefaultModel();
- jena2 = testResults.createResource(BASE_RESULTS_URI + "#jena2");
- jena2.addProperty(RDFS.comment,
- testResults.createLiteral(
- "<a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"http://jena.sourceforce.net/\">Jena2</a> includes a rule-based inference engine for RDF processing, " +
- "supporting both forward and backward chaining rules. Its OWL rule set is designed to provide sound " +
- "but not complete instance resasoning for that fragment of OWL/Full limited to the OWL/lite vocabulary. In" +
- "particular it does not support unionOf/complementOf.",
- true)
- );
- jena2.addProperty(RDFS.label, "Jena2");
+ jena2 = testResults.createResource(BASE_RESULTS_URI + "#jena");
+ jena2.addProperty(RDFS.label, "Jena");
testResults.setNsPrefix("results", OWLResults.NS);
}
-
+
/**
* Boilerplate for junit.
* This is its own test suite
@@ -89,14 +81,14 @@
Resource config = newResource()
.addProperty(ReasonerVocabulary.PROPsetRDFSLevel, "full");
constructRDFWGtests(suite, RDFSRuleReasonerFactory.theInstance(), config);
-
+
} catch (IOException e) {
// failed to even built the test harness
logger.error("Failed to construct RDF WG test harness", e);
}
return suite;
- }
-
+ }
+
/**
* Build the working group tests for the given reasoner.
*/
@@ -107,28 +99,28 @@
{
suite.addTest( new TestReasonerWG( tester, test, rf, config ) );
}
- }
+ }
/**
- * Inner class defining a test framework for invoking a single
+ * Inner class defining a test framework for invoking a single
* RDFCore working group test.
*/
static class TestReasonerWG extends TestCase {
-
+
/** The tester which already has the test manifest loaded */
WGReasonerTester tester;
-
+
/** The name of the specific test to run */
String test;
-
+
/** The factory for the reasoner type under test */
ReasonerFactory reasonerFactory;
-
+
/** An optional configuration model */
Resource config;
-
+
/** Constructor */
- TestReasonerWG(WGReasonerTester tester, String test,
+ TestReasonerWG(WGReasonerTester tester, String test,
ReasonerFactory reasonerFactory, Resource config) {
super(test);
this.tester = tester;
@@ -136,7 +128,7 @@
this.reasonerFactory = reasonerFactory;
this.config = config;
}
-
+
/**
* The test runner
*/
@@ -144,7 +136,7 @@
public void runTest() throws IOException {
boolean success = tester.runTest(test, reasonerFactory, this, config);
// Resource resultType = null;
-// if (test.hasProperty(RDF.type, OWLTest.NegativeEntailmentTest)
+// if (test.hasProperty(RDF.type, OWLTest.NegativeEntailmentTest)
// || test.hasProperty(RDF.type, OWLTest.ConsistencyTest)) {
// resultType = success ? OWLResults.PassingRun : OWLResults.FailingRun;
// } else {
@@ -160,5 +152,5 @@
}
}
-
+
}
diff --git a/jena-core/src/test/java/org/apache/jena/testing_framework/NodeCreateUtils.java b/jena-core/src/test/java/org/apache/jena/testing_framework/NodeCreateUtils.java
index b17282b..3330bf8 100644
--- a/jena-core/src/test/java/org/apache/jena/testing_framework/NodeCreateUtils.java
+++ b/jena-core/src/test/java/org/apache/jena/testing_framework/NodeCreateUtils.java
@@ -48,7 +48,7 @@
* <li>&PPP :: to be done
* <li>name:stuff :: the URI; name may be expanded using the Extended map
* </ul>
- *
+ *
* @param x
* the string describing the node
* @return a node of the appropriate type with the appropriate label
@@ -72,13 +72,14 @@
* <li>&PPP :: to be done
* <li>name:stuff :: the URI; name may be expanded using the Extended map
* </ul>
- *
+ *
* @param pm
* the PrefixMapping for translating pre:X strings
* @param x
* the string encoding the node to create
* @return a node with the appropriate type and label
*/
+ @SuppressWarnings("deprecation")
public static Node create(PrefixMapping pm, String x) {
if (x.equals(""))
throw new JenaException(