clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r955622 - in /incubator/clerezza/trunk/org.apache.clerezza.parent: org.apache.clerezza.platform.language/org.apache.clerezza.platform.language.core/src/main/java/org/apache/clerezza/platform/language/ org.apache.clerezza.rdf.core/src/main/j...
Date Thu, 17 Jun 2010 15:01:07 GMT
Author: reto
Date: Thu Jun 17 15:01:06 2010
New Revision: 955622

URL: http://svn.apache.org/viewvc?rev=955622&view=rev
Log:
CLEREZZA-239: support base-uri in parser

Modified:
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.language/org.apache.clerezza.platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/ParsingProvider.java
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.jena.parser/src/main/java/org/apache/clerezza/rdf/jena/parser/JenaParserProvider.java
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParsingProvider.java

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.language/org.apache.clerezza.platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.language/org.apache.clerezza.platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java?rev=955622&r1=955621&r2=955622&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.language/org.apache.clerezza.platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java
(original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.language/org.apache.clerezza.platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java
Thu Jun 17 15:01:06 2010
@@ -214,7 +214,7 @@ public class LanguageService {	
 		}
 		try {
 			lingvojGraph = parser.parse(config.openStream(),
-					SupportedFormat.RDF_XML);
+					SupportedFormat.RDF_XML, null);
 			softLingvojGraph = new SoftReference<Graph>(lingvojGraph);
 			return lingvojGraph;
 		} catch (IOException ex) {

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java?rev=955622&r1=955621&r2=955622&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
(original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
Thu Jun 17 15:01:06 2010
@@ -30,6 +30,7 @@ import java.util.ServiceLoader;
 import java.util.Set;
 
 import org.apache.clerezza.rdf.core.Graph;
+import org.apache.clerezza.rdf.core.UriRef;
 
 /**
  * This singleton class provides a method <code>parse</code> to transform 
@@ -122,6 +123,10 @@ public class Parser {
 	 */
 	public Graph parse(InputStream serializedGraph,
 			String formatIdentifier) throws UnsupportedFormatException {
+		return parse(serializedGraph, formatIdentifier, null);
+	}
+	public Graph parse(InputStream serializedGraph,
+			String formatIdentifier, UriRef baseUri) throws UnsupportedFormatException {
 		String deParameterizedIdentifier;
 		int semicolonPos = formatIdentifier.indexOf(';');
 		if (semicolonPos > -1) {
@@ -133,7 +138,7 @@ public class Parser {
 		if (provider == null) {
 			throw new UnsupportedParsingFormatException(formatIdentifier);
 		}
-		return provider.parse(serializedGraph, formatIdentifier);
+		return provider.parse(serializedGraph, formatIdentifier, baseUri);
 	}
 	
 	/**

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/ParsingProvider.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/ParsingProvider.java?rev=955622&r1=955621&r2=955622&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/ParsingProvider.java
(original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/ParsingProvider.java
Thu Jun 17 15:01:06 2010
@@ -21,6 +21,7 @@ package org.apache.clerezza.rdf.core.ser
 import java.io.InputStream;
 
 import org.apache.clerezza.rdf.core.Graph;
+import org.apache.clerezza.rdf.core.UriRef;
 
 /**
  * An instance of this class parses RDF-Graph from one or more serialization
@@ -39,8 +40,9 @@ public interface ParsingProvider {
 	 *
 	 * @param serializedGraph the stream from which the serialized graph is read
 	 * @param formatIdentifier a String identifying the format
+	 * @param baseUri the baseUri for interpreting relative uris, may be null
 	 * @return the graph read from <code>serializedGraph</code>
 	 */
-	Graph parse(InputStream serializedGraph, String formatIdentifier);
+	Graph parse(InputStream serializedGraph, String formatIdentifier, UriRef baseUri);
 
 }

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.jena.parser/src/main/java/org/apache/clerezza/rdf/jena/parser/JenaParserProvider.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.jena.parser/src/main/java/org/apache/clerezza/rdf/jena/parser/JenaParserProvider.java?rev=955622&r1=955621&r2=955622&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.jena.parser/src/main/java/org/apache/clerezza/rdf/jena/parser/JenaParserProvider.java
(original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.jena.parser/src/main/java/org/apache/clerezza/rdf/jena/parser/JenaParserProvider.java
Thu Jun 17 15:01:06 2010
@@ -16,73 +16,79 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.rdf.jena.parser;
-
-import java.io.InputStream;
-
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.serializedform.ParsingProvider;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.apache.clerezza.rdf.jena.facade.JenaGraph;
-
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.ModelFactory;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.clerezza.rdf.core.serializedform.UnsupportedParsingFormatException;
-/**
- * A {@link org.apache.clerezza.rdf.core.serializedform.ParsingProvider} based on Jena
- *
- * @author reto, mir
- */
-
-/*
- * see http://jena.sourceforge.net/IO/iohowto.html
- */
-@Component(immediate=true)
-@Service(ParsingProvider.class)
-@Property(name="supportedFormat", value={SupportedFormat.RDF_XML,
-	SupportedFormat.TURTLE,	SupportedFormat.X_TURTLE,
-	SupportedFormat.N_TRIPLE, SupportedFormat.N3})
-@SupportedFormat({SupportedFormat.RDF_XML,
-	SupportedFormat.TURTLE,	SupportedFormat.X_TURTLE,
-	SupportedFormat.N_TRIPLE, SupportedFormat.N3})
-public class JenaParserProvider implements ParsingProvider {
-
-	@Override
-	public Graph parse(InputStream serializedGraph, String formatIdentifier) {
-		String jenaFormat = getJenaFormat(formatIdentifier);
-		MGraph mResult = new SimpleMGraph();
-		com.hp.hpl.jena.graph.Graph graph = new JenaGraph(mResult);
-		Model model = ModelFactory.createModelForGraph(graph);
-		String base = "urn:x-relative:";
-		model.read(serializedGraph, base, jenaFormat);
-		return mResult.getGraph();
-	}
-
-	private String getJenaFormat(String formatIdentifier) {
-		int semicolonPos = formatIdentifier.indexOf(';');
-		if (semicolonPos > -1) {
-			formatIdentifier = formatIdentifier.substring(0, semicolonPos);
-		}
-		if (formatIdentifier.equals(SupportedFormat.RDF_XML)) {
-			return "RDF/XML-ABBREV";
-		}
-		if (formatIdentifier.equals(SupportedFormat.TURTLE) ||
-				formatIdentifier.equals(SupportedFormat.X_TURTLE)) {
-			return "TURTLE";
-		}
-		if (formatIdentifier.equals(SupportedFormat.N3)) {
-			return "N3";
-		}
-		if (formatIdentifier.equals(SupportedFormat.N_TRIPLE)) {
-			return "N-TRIPLE";
-		}
-		throw new UnsupportedParsingFormatException(formatIdentifier);
-	}
-
-}
+package org.apache.clerezza.rdf.jena.parser;
+
+import java.io.InputStream;
+
+import org.apache.clerezza.rdf.core.Graph;
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.rdf.core.serializedform.ParsingProvider;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+import org.apache.clerezza.rdf.jena.facade.JenaGraph;
+
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.clerezza.rdf.core.serializedform.UnsupportedParsingFormatException;
+/**
+ * A {@link org.apache.clerezza.rdf.core.serializedform.ParsingProvider} based on Jena
+ *
+ * @author reto, mir
+ */
+
+/*
+ * see http://jena.sourceforge.net/IO/iohowto.html
+ */
+@Component(immediate=true)
+@Service(ParsingProvider.class)
+@Property(name="supportedFormat", value={SupportedFormat.RDF_XML,
+	SupportedFormat.TURTLE,	SupportedFormat.X_TURTLE,
+	SupportedFormat.N_TRIPLE, SupportedFormat.N3})
+@SupportedFormat({SupportedFormat.RDF_XML,
+	SupportedFormat.TURTLE,	SupportedFormat.X_TURTLE,
+	SupportedFormat.N_TRIPLE, SupportedFormat.N3})
+public class JenaParserProvider implements ParsingProvider {
+
+	@Override
+	public Graph parse(InputStream serializedGraph, String formatIdentifier, UriRef baseUri)
{
+		String jenaFormat = getJenaFormat(formatIdentifier);
+		MGraph mResult = new SimpleMGraph();
+		com.hp.hpl.jena.graph.Graph graph = new JenaGraph(mResult);
+		Model model = ModelFactory.createModelForGraph(graph);
+		String base;
+		if (baseUri == null) {
+			base = "urn:x-relative:";
+		} else {
+			base = baseUri.getUnicodeString();
+		}
+		model.read(serializedGraph, base, jenaFormat);
+		return mResult.getGraph();
+	}
+
+	private String getJenaFormat(String formatIdentifier) {
+		int semicolonPos = formatIdentifier.indexOf(';');
+		if (semicolonPos > -1) {
+			formatIdentifier = formatIdentifier.substring(0, semicolonPos);
+		}
+		if (formatIdentifier.equals(SupportedFormat.RDF_XML)) {
+			return "RDF/XML-ABBREV";
+		}
+		if (formatIdentifier.equals(SupportedFormat.TURTLE) ||
+				formatIdentifier.equals(SupportedFormat.X_TURTLE)) {
+			return "TURTLE";
+		}
+		if (formatIdentifier.equals(SupportedFormat.N3)) {
+			return "N3";
+		}
+		if (formatIdentifier.equals(SupportedFormat.N_TRIPLE)) {
+			return "N-TRIPLE";
+		}
+		throw new UnsupportedParsingFormatException(formatIdentifier);
+	}
+
+}

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParsingProvider.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParsingProvider.java?rev=955622&r1=955621&r2=955622&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParsingProvider.java
(original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParsingProvider.java
Thu Jun 17 15:01:06 2010
@@ -16,123 +16,123 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.clerezza.rdf.rdfjson.parser;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-import org.json.simple.parser.ParseException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.Language;
-import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
-import org.apache.clerezza.rdf.core.serializedform.ParsingProvider;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-
-/**
- * A {@link org.apache.clerezza.rdf.core.serializedform.ParsingProvider} for rdf/json
- * 
- * @author tio *
- * @scr.component immediate="true"
- * @scr.service interface="org.apache.clerezza.rdf.core.serializedform.ParsingProvider"
- * 
- */
-@SupportedFormat( SupportedFormat.RDF_JSON )
-public class RdfJsonParsingProvider implements ParsingProvider {
-
-	private final Logger logger = LoggerFactory.getLogger(getClass());
-
-	@Override
-	public Graph parse(InputStream serializedGraph, String formatIdentifier) {
-
-		MGraph mGraph = new SimpleMGraph();
-		JSONParser parser = new JSONParser();
-		InputStreamReader reader = new InputStreamReader(serializedGraph);
-		try {
-			JSONObject root = (JSONObject) parser.parse(reader);
-			Map<String, NonLiteral> subjects = createSubjectsFromJSONObjects(root);
-			for (String keyString : subjects.keySet()) {
-				NonLiteral key = subjects.get(keyString);
-				JSONObject predicates = (JSONObject) root.get(keyString);
-				addValuesToGraph(key, subjects, predicates, mGraph);
-			}
-		} catch (IOException ioe) {
-			logger.error(ioe.getMessage());
-			throw new RuntimeException(ioe.getMessage());
-		} catch (ParseException pe) {
-			logger.error(pe.getMessage());
-			throw new RuntimeException(pe.getMessage());
-		}
-		return mGraph.getGraph();
-	}
-
-	private Map<String, NonLiteral> createSubjectsFromJSONObjects(
-			JSONObject root) {
-		Map<String, NonLiteral> subjectsAsJSONObjects = new HashMap<String, NonLiteral>();
-
-		for (Object key : root.keySet()) {
-			String keyString = (String) key;
-			if (keyString.startsWith("_:")) {
-				BNode bNode = new BNode();
-				subjectsAsJSONObjects.put(keyString, bNode);
-			} else {
-				UriRef uri = new UriRef(keyString);
-				subjectsAsJSONObjects.put(keyString, uri);
-			}
-		}
-		return subjectsAsJSONObjects;
-	}
-	
-	private void addValuesToGraph(NonLiteral key, Map<String, NonLiteral> subjects,
-			JSONObject predicates, MGraph mGraph) {
-		for (Object predicate : predicates.keySet()) {
-			JSONArray objects = (JSONArray) predicates.get(predicate);
-			for (Object object : objects) {
-				JSONObject values = (JSONObject) object;
-				String value = (String) values.get("value");
-				if (values.get("type").equals("literal")) {
-					if (values.containsKey("datatype")
-							&& !values.get("datatype").equals("")
-							&& values.get("datatype") != null) {
-						mGraph.add(new TripleImpl(key, new UriRef(
-								(String) predicate), LiteralFactory
-								.getInstance()
-								.createTypedLiteral(value)));
-					} else if (values.containsKey("lang")
-							&& !values.get("lang").equals("")
-							&& values.get("lang") != null) {
-						mGraph.add(new TripleImpl(key, new UriRef(
-								(String) predicate),
-								new PlainLiteralImpl(value,
-										new Language((String) values
-												.get("lang")))));
-					} else {
-						mGraph.add(new TripleImpl(key, new UriRef(
-								(String) predicate),
-								new PlainLiteralImpl(value)));
-					}
-				} else if (values.get("type").equals("uri")) {
-					mGraph.add(new TripleImpl(key, new UriRef(
-							(String) predicate), new UriRef(value)));
-				} else if (values.get("type").equals("bnode")) {
-					mGraph.add(new TripleImpl(key, new UriRef(
-							(String) predicate), subjects.get(value)));
-				}
-			}
-		}
-	}
-}
+package org.apache.clerezza.rdf.rdfjson.parser;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.clerezza.rdf.core.BNode;
+import org.apache.clerezza.rdf.core.Graph;
+import org.apache.clerezza.rdf.core.Language;
+import org.apache.clerezza.rdf.core.LiteralFactory;
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.NonLiteral;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.clerezza.rdf.core.serializedform.ParsingProvider;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+
+/**
+ * A {@link org.apache.clerezza.rdf.core.serializedform.ParsingProvider} for rdf/json
+ * 
+ * @author tio *
+ * @scr.component immediate="true"
+ * @scr.service interface="org.apache.clerezza.rdf.core.serializedform.ParsingProvider"
+ * 
+ */
+@SupportedFormat( SupportedFormat.RDF_JSON )
+public class RdfJsonParsingProvider implements ParsingProvider {
+
+	private final Logger logger = LoggerFactory.getLogger(getClass());
+
+	@Override
+	public Graph parse(InputStream serializedGraph, String formatIdentifier, UriRef baseUri)
{
+
+		MGraph mGraph = new SimpleMGraph();
+		JSONParser parser = new JSONParser();
+		InputStreamReader reader = new InputStreamReader(serializedGraph);
+		try {
+			JSONObject root = (JSONObject) parser.parse(reader);
+			Map<String, NonLiteral> subjects = createSubjectsFromJSONObjects(root);
+			for (String keyString : subjects.keySet()) {
+				NonLiteral key = subjects.get(keyString);
+				JSONObject predicates = (JSONObject) root.get(keyString);
+				addValuesToGraph(key, subjects, predicates, mGraph);
+			}
+		} catch (IOException ioe) {
+			logger.error(ioe.getMessage());
+			throw new RuntimeException(ioe.getMessage());
+		} catch (ParseException pe) {
+			logger.error(pe.getMessage());
+			throw new RuntimeException(pe.getMessage());
+		}
+		return mGraph.getGraph();
+	}
+
+	private Map<String, NonLiteral> createSubjectsFromJSONObjects(
+			JSONObject root) {
+		Map<String, NonLiteral> subjectsAsJSONObjects = new HashMap<String, NonLiteral>();
+
+		for (Object key : root.keySet()) {
+			String keyString = (String) key;
+			if (keyString.startsWith("_:")) {
+				BNode bNode = new BNode();
+				subjectsAsJSONObjects.put(keyString, bNode);
+			} else {
+				UriRef uri = new UriRef(keyString);
+				subjectsAsJSONObjects.put(keyString, uri);
+			}
+		}
+		return subjectsAsJSONObjects;
+	}
+	
+	private void addValuesToGraph(NonLiteral key, Map<String, NonLiteral> subjects,
+			JSONObject predicates, MGraph mGraph) {
+		for (Object predicate : predicates.keySet()) {
+			JSONArray objects = (JSONArray) predicates.get(predicate);
+			for (Object object : objects) {
+				JSONObject values = (JSONObject) object;
+				String value = (String) values.get("value");
+				if (values.get("type").equals("literal")) {
+					if (values.containsKey("datatype")
+							&& !values.get("datatype").equals("")
+							&& values.get("datatype") != null) {
+						mGraph.add(new TripleImpl(key, new UriRef(
+								(String) predicate), LiteralFactory
+								.getInstance()
+								.createTypedLiteral(value)));
+					} else if (values.containsKey("lang")
+							&& !values.get("lang").equals("")
+							&& values.get("lang") != null) {
+						mGraph.add(new TripleImpl(key, new UriRef(
+								(String) predicate),
+								new PlainLiteralImpl(value,
+										new Language((String) values
+												.get("lang")))));
+					} else {
+						mGraph.add(new TripleImpl(key, new UriRef(
+								(String) predicate),
+								new PlainLiteralImpl(value)));
+					}
+				} else if (values.get("type").equals("uri")) {
+					mGraph.add(new TripleImpl(key, new UriRef(
+							(String) predicate), new UriRef(value)));
+				} else if (values.get("type").equals("bnode")) {
+					mGraph.add(new TripleImpl(key, new UriRef(
+							(String) predicate), subjects.get(value)));
+				}
+			}
+		}
+	}
+}



Mime
View raw message