Author: kelly
Date: Thu Jul 29 22:24:39 2010
New Revision: 980597
URL: http://svn.apache.org/viewvc?rev=980597&view=rev
Log:
Update Jena dependency from the ancient 1.6.1 to latest 2.6.3—along with the
numerous API differences required!
Removed:
incubator/oodt/trunk/profile/src/testdata/test.rdf
Modified:
incubator/oodt/trunk/profile/pom.xml
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/Profile.java
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/RangedProfileElement.java
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/UnspecifiedProfileElement.java
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/Utility.java
incubator/oodt/trunk/profile/src/test/org/apache/oodt/profile/ProfileTest.java
Modified: incubator/oodt/trunk/profile/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/oodt/trunk/profile/pom.xml?rev=980597&r1=980596&r2=980597&view=diff
==============================================================================
--- incubator/oodt/trunk/profile/pom.xml (original)
+++ incubator/oodt/trunk/profile/pom.xml Thu Jul 29 22:24:39 2010
@@ -109,9 +109,9 @@
<version>${oodt.version}</version>
</dependency>
<dependency>
- <groupId>com.hp.hpl</groupId>
+ <groupId>com.hp.hpl.jena</groupId>
<artifactId>jena</artifactId>
- <version>1.6.1</version>
+ <version>2.6.3</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
Modified:
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java
URL:
http://svn.apache.org/viewvc/incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java?rev=980597&r1=980596&r2=980597&view=diff
==============================================================================
---
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java
(original)
+++
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java
Thu Jul 29 22:24:39 2010
@@ -23,9 +23,8 @@ import java.util.List;
import org.apache.oodt.commons.util.XML;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
-import com.hp.hpl.mesa.rdf.jena.model.Model;
-import com.hp.hpl.mesa.rdf.jena.model.Resource;
-import com.hp.hpl.mesa.rdf.jena.model.RDFException;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.Resource;
import java.net.URI;
import java.util.Iterator;
import org.w3c.dom.Element;
@@ -94,8 +93,7 @@ public class EnumeratedProfileElement ex
return values;
}
- protected void addElementSpecificProperties(Model model, Resource
element, ProfileAttributes profAttr, URI uri)
- throws RDFException {
+ protected void addElementSpecificProperties(Model model, Resource
element, ProfileAttributes profAttr, URI uri) {
Utility.addProperty(model, element, Utility.edmValue, values,
profAttr, uri);
}
Modified:
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/Profile.java
URL:
http://svn.apache.org/viewvc/incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/Profile.java?rev=980597&r1=980596&r2=980597&view=diff
==============================================================================
---
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/Profile.java
(original)
+++
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/Profile.java
Thu Jul 29 22:24:39 2010
@@ -18,11 +18,10 @@
package org.apache.oodt.profile;
-import com.hp.hpl.mesa.rdf.jena.mem.ModelMem;
-import com.hp.hpl.mesa.rdf.jena.model.Model;
-import com.hp.hpl.mesa.rdf.jena.model.Property;
-import com.hp.hpl.mesa.rdf.jena.model.RDFException;
-import com.hp.hpl.mesa.rdf.jena.model.Resource;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.Property;
+import com.hp.hpl.jena.rdf.model.Resource;
import java.io.IOException;
import java.io.Serializable;
import java.net.URI;
@@ -268,9 +267,8 @@ public class Profile implements Serializ
* and adds them all to the given model.
*
* @param model Model to which to add the profile and its related
descriptions.
- * @throws RDFException if an error occurs.
*/
- public void addToModel(Model model) throws RDFException {
+ public void addToModel(Model model) {
Resource resource = model.createResource(getURI().toString());
resAttr.addToModel(model, resource, profAttr);
for (Iterator i = elements.values().iterator(); i.hasNext();) {
@@ -383,7 +381,7 @@ public class Profile implements Serializ
reader.close();
Profile p = new Profile(b.toString());
- Model model = new ModelMem();
+ Model model = ModelFactory.createDefaultModel();
p.addToModel(model);
OutputStreamWriter writer = new OutputStreamWriter(System.out);
model.write(writer);
Modified:
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java
URL:
http://svn.apache.org/viewvc/incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java?rev=980597&r1=980596&r2=980597&view=diff
==============================================================================
---
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java
(original)
+++
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java
Thu Jul 29 22:24:39 2010
@@ -18,9 +18,8 @@
package org.apache.oodt.profile;
-import com.hp.hpl.mesa.rdf.jena.model.Model;
-import com.hp.hpl.mesa.rdf.jena.model.RDFException;
-import com.hp.hpl.mesa.rdf.jena.model.Resource;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.Resource;
import java.io.Serializable;
import java.net.URI;
import java.util.ArrayList;
@@ -446,9 +445,8 @@ public abstract class ProfileElement imp
* @param model The model to which we're being added.
* @param resource The profile as an RDF resource description.
* @param profAttr The profile's attributes.
- * @throws RDFException if an error occurs.
*/
- void addToModel(Model model, Resource resource, ProfileAttributes
profAttr) throws RDFException {
+ void addToModel(Model model, Resource resource, ProfileAttributes
profAttr) {
URI profileURI = profile.getURI();
URI myURI = URI.create(profileURI.toString() + "#" + name);
@@ -476,10 +474,8 @@ public abstract class ProfileElement imp
* @param model The model.
* @param element This element, as an RDF resource.
* @param profAttr The attributes of the element's profile.
- * @throws RDFException if an error occurs.
*/
- protected abstract void addElementSpecificProperties(Model model,
Resource element, ProfileAttributes profAttr, URI uri)
- throws RDFException;
+ protected abstract void addElementSpecificProperties(Model model,
Resource element, ProfileAttributes profAttr, URI uri);
/** My profile. */
protected Profile profile;
Modified:
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/RangedProfileElement.java
URL:
http://svn.apache.org/viewvc/incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/RangedProfileElement.java?rev=980597&r1=980596&r2=980597&view=diff
==============================================================================
---
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/RangedProfileElement.java
(original)
+++
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/RangedProfileElement.java
Thu Jul 29 22:24:39 2010
@@ -24,9 +24,8 @@ import java.util.List;
import org.apache.oodt.commons.util.XML;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
-import com.hp.hpl.mesa.rdf.jena.model.RDFException;
-import com.hp.hpl.mesa.rdf.jena.model.Model;
-import com.hp.hpl.mesa.rdf.jena.model.Resource;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.Resource;
import java.net.URI;
/**
@@ -100,8 +99,7 @@ public class RangedProfileElement extend
return Collections.EMPTY_LIST;
}
- protected void addElementSpecificProperties(Model model, Resource
element, ProfileAttributes profAttr, URI uri)
- throws RDFException {
+ protected void addElementSpecificProperties(Model model, Resource
element, ProfileAttributes profAttr, URI uri) {
Utility.addProperty(model, element, Utility.edmMinValue, min,
profAttr, uri);
Utility.addProperty(model, element, Utility.edmMaxValue, max,
profAttr, uri);
}
Modified:
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java
URL:
http://svn.apache.org/viewvc/incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java?rev=980597&r1=980596&r2=980597&view=diff
==============================================================================
---
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java
(original)
+++
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java
Thu Jul 29 22:24:39 2010
@@ -18,11 +18,9 @@
package org.apache.oodt.profile;
-import com.hp.hpl.mesa.rdf.jena.mem.ModelMem;
-import com.hp.hpl.mesa.rdf.jena.model.Model;
-import com.hp.hpl.mesa.rdf.jena.model.Property;
-import com.hp.hpl.mesa.rdf.jena.model.RDFException;
-import com.hp.hpl.mesa.rdf.jena.model.Resource;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.Property;
+import com.hp.hpl.jena.rdf.model.Resource;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
@@ -209,9 +207,8 @@ public class ResourceAttributes implemen
* @param model Model to which the profile belongs.
* @param resource Resource description of the profile.
* @param profAttr Profile's attributes.
- * @throws RDFException if an error occurs.
*/
- void addToModel(Model model, Resource resource, ProfileAttributes
profAttr) throws RDFException {
+ void addToModel(Model model, Resource resource, ProfileAttributes
profAttr) {
URI myURI = getURI();
Utility.addProperty(model, resource, Utility.dcTitle,
title, profAttr, myURI);
Modified:
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/UnspecifiedProfileElement.java
URL:
http://svn.apache.org/viewvc/incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/UnspecifiedProfileElement.java?rev=980597&r1=980596&r2=980597&view=diff
==============================================================================
---
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/UnspecifiedProfileElement.java
(original)
+++
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/UnspecifiedProfileElement.java
Thu Jul 29 22:24:39 2010
@@ -22,8 +22,8 @@ import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import org.w3c.dom.Node;
-import com.hp.hpl.mesa.rdf.jena.model.Model;
-import com.hp.hpl.mesa.rdf.jena.model.Resource;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.Resource;
import java.net.URI;
/**
Modified:
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/Utility.java
URL:
http://svn.apache.org/viewvc/incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/Utility.java?rev=980597&r1=980596&r2=980597&view=diff
==============================================================================
---
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/Utility.java
(original)
+++
incubator/oodt/trunk/profile/src/main/java/org/apache/oodt/profile/Utility.java
Thu Jul 29 22:24:39 2010
@@ -19,15 +19,14 @@ import org.apache.oodt.commons.Configura
import java.io.IOException;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
-import com.hp.hpl.mesa.rdf.jena.mem.ModelMem;
-import com.hp.hpl.mesa.rdf.jena.model.Model;
-import com.hp.hpl.mesa.rdf.jena.model.Resource;
-import com.hp.hpl.mesa.rdf.jena.model.Property;
-import com.hp.hpl.mesa.rdf.jena.model.RDFException;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.Resource;
+import com.hp.hpl.jena.rdf.model.Property;
import java.util.Iterator;
import java.util.Collection;
-import com.hp.hpl.mesa.rdf.jena.model.Bag;
-import com.hp.hpl.mesa.rdf.jena.model.Seq;
+import com.hp.hpl.jena.rdf.model.Bag;
+import com.hp.hpl.jena.rdf.model.Seq;
import java.util.List;
import java.net.URI;
@@ -47,7 +46,7 @@ class Utility {
}
static void addProperty(Model model, Resource resource, Property
property, Object value, ProfileAttributes profAttr,
- URI uri) throws RDFException {
+ URI uri) {
if (value == null || value.toString().length() == 0) return;
@@ -61,7 +60,7 @@ class Utility {
resource.addProperty(property, bag);
obj = bag;
} else {
- resource.addProperty(property, value);
+ resource.addProperty(property, value.toString());
obj = value;
}
@@ -69,7 +68,7 @@ class Utility {
reification.addProperty(rdfSubject, resource);
reification.addProperty(rdfPredicate, property);
- reification.addProperty(rdfObject, obj);
+ reification.addProperty(rdfObject, obj.toString());
reification.addProperty(rdfType, rdfStatement);
addPotentiallyNullReifiedStatement(reification, edmID,
profAttr.getVersion());
@@ -97,10 +96,9 @@ class Utility {
}
}
- private static void addPotentiallyNullReifiedStatement(Resource
reification, Property property, Object value)
- throws RDFException {
+ private static void addPotentiallyNullReifiedStatement(Resource
reification, Property property, Object value) {
if (value == null || value.toString().length() == 0) return;
- reification.addProperty(property, value);
+ reification.addProperty(property, value.toString());
}
@@ -173,7 +171,7 @@ class Utility {
try {
Configuration config = Configuration.getConfiguration();
String profNS = System.getProperty("jpl.rdf.ns",
"http://oodt.jpl.nasa.gov/grid-profile/rdfs/prof.rdf");
- Model model = new ModelMem();
+ Model model = ModelFactory.createDefaultModel();
rdfStatement = model.createResource(RDF_SYNTAX_NS +
"Statement");
@@ -237,9 +235,6 @@ class Utility {
: " (embedded exception " +
ex.getException().getClass().getName() + ": "
+ ex.getException().getMessage() + ")"));
System.exit(1);
- } catch (RDFException ex) {
- System.err.println("Fatal RDF exception " +
ex.getClass().getName() + ": " + ex.getMessage());
- System.exit(1);
}
}
}
Modified:
incubator/oodt/trunk/profile/src/test/org/apache/oodt/profile/ProfileTest.java
URL:
http://svn.apache.org/viewvc/incubator/oodt/trunk/profile/src/test/org/apache/oodt/profile/ProfileTest.java?rev=980597&r1=980596&r2=980597&view=diff
==============================================================================
---
incubator/oodt/trunk/profile/src/test/org/apache/oodt/profile/ProfileTest.java
(original)
+++
incubator/oodt/trunk/profile/src/test/org/apache/oodt/profile/ProfileTest.java
Thu Jul 29 22:24:39 2010
@@ -19,16 +19,16 @@
package org.apache.oodt.profile;
import java.io.BufferedReader;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Map;
import org.apache.oodt.commons.util.XML;
import junit.framework.TestCase;
import org.w3c.dom.Document;
-import com.hp.hpl.mesa.rdf.jena.model.Model;
-import com.hp.hpl.mesa.rdf.jena.mem.ModelMem;
-import com.hp.hpl.mesa.rdf.jena.model.RDFException;
-import com.hp.hpl.mesa.rdf.jena.model.Resource;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.Resource;
import java.io.FileWriter;
import java.io.IOException;
@@ -120,16 +120,6 @@ public class ProfileTest extends TestCas
assertEquals("system.profileServer",
profile2.getResourceAttributes().getResClass());
}
- public void testRDF() throws RDFException, IOException {
- InputStreamReader in = new
InputStreamReader(getClass().getResourceAsStream("test.rdf"));
- Model std = new ModelMem().read(in, /*base*/"", "RDF/XML");
- in.close();
-
- Model model = new ModelMem();
- profile1.addToModel(model);
- assertEquals(std, model);
- }
-
/** A test profile, built from a string. */
private Profile profile1;