clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject svn commit: r1073576 - in /incubator/clerezza/trunk/parent/rdf.rdfjson/src: main/java/org/apache/clerezza/rdf/rdfjson/parser/ main/java/org/apache/clerezza/rdf/rdfjson/serializer/ test/java/org/apache/clerezza/rdf/rdfjson/parser/ test/java/org/apache/c...
Date Wed, 23 Feb 2011 01:44:46 GMT
Author: hasan
Date: Wed Feb 23 01:44:46 2011
New Revision: 1073576

URL: http://svn.apache.org/viewvc?rev=1073576&view=rev
Log:
CLEREZZA-435: updated for coding convention compliance

Modified:
    incubator/clerezza/trunk/parent/rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParsingProvider.java
    incubator/clerezza/trunk/parent/rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/serializer/RdfJsonSerializingProvider.java
    incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParserProviderTest.java
    incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/java/org/apache/clerezza/rdf/rdfjson/serializer/RdfJsonSerializerProviderTest.java
    incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/resources/org/apache/clerezza/rdf/rdfjson/parser/test.json

Modified: incubator/clerezza/trunk/parent/rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParsingProvider.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParsingProvider.java?rev=1073576&r1=1073575&r2=1073576&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParsingProvider.java
(original)
+++ incubator/clerezza/trunk/parent/rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParsingProvider.java
Wed Feb 23 01:44:46 2011
@@ -1,20 +1,18 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
  *
  *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.clerezza.rdf.rdfjson.parser;
 
@@ -23,7 +21,6 @@ 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;
@@ -31,14 +28,12 @@ import org.json.simple.parser.ParseExcep
 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;
@@ -51,7 +46,7 @@ import org.apache.clerezza.rdf.core.seri
  * @scr.service interface="org.apache.clerezza.rdf.core.serializedform.ParsingProvider"
  * 
  */
-@SupportedFormat( SupportedFormat.RDF_JSON )
+@SupportedFormat(SupportedFormat.RDF_JSON)
 public class RdfJsonParsingProvider implements ParsingProvider {
 
 	private final Logger logger = LoggerFactory.getLogger(getClass());
@@ -78,8 +73,7 @@ public class RdfJsonParsingProvider impl
 		}
 	}
 
-	private Map<String, NonLiteral> createSubjectsFromJSONObjects(
-			JSONObject root) {
+	private Map<String, NonLiteral> createSubjectsFromJSONObjects(JSONObject root) {
 		Map<String, NonLiteral> subjectsAsJSONObjects = new HashMap<String, NonLiteral>();
 
 		for (Object key : root.keySet()) {
@@ -94,9 +88,9 @@ public class RdfJsonParsingProvider impl
 		}
 		return subjectsAsJSONObjects;
 	}
-	
-	private void addValuesToGraph(NonLiteral key, Map<String, NonLiteral> subjects,
-			JSONObject predicates, MGraph mGraph) {
+
+	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) {
@@ -106,29 +100,20 @@ public class RdfJsonParsingProvider impl
 					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)));
+						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")))));
+						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)));
+						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)));
+					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)));
+					mGraph.add(new TripleImpl(key, new UriRef((String) predicate), subjects.get(value)));
 				}
 			}
 		}

Modified: incubator/clerezza/trunk/parent/rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/serializer/RdfJsonSerializingProvider.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/serializer/RdfJsonSerializingProvider.java?rev=1073576&r1=1073575&r2=1073576&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/serializer/RdfJsonSerializingProvider.java
(original)
+++ incubator/clerezza/trunk/parent/rdf.rdfjson/src/main/java/org/apache/clerezza/rdf/rdfjson/serializer/RdfJsonSerializingProvider.java
Wed Feb 23 01:44:46 2011
@@ -1,147 +1,135 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
  *
  *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-package org.apache.clerezza.rdf.rdfjson.serializer;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.PlainLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.TypedLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.serializedform.SerializingProvider;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-
-/**
- * A {@link org.apache.clerezza.rdf.core.serializedform.SerializingProvider} for
- * rdf/json
- * 
- * @author tio
- * 
- * @scr.component immediate="true"
- * @scr.service 
- *              interface="org.apache.clerezza.rdf.core.serializedform.SerializingProvider"
- * 
- */
-@SupportedFormat( SupportedFormat.RDF_JSON )
-public class RdfJsonSerializingProvider implements SerializingProvider {
-
-	private final Logger logger = LoggerFactory.getLogger(getClass());
-
-	@Override
-	public void serialize(OutputStream serializedGraph, TripleCollection tc,
-			String formatIdentifier) {
-		JSONObject root = new JSONObject();
-
-		Map<NonLiteral, String> subjectsAsJSONObjects = createSubjectsAsJSONObjects(tc);
-
-		for (NonLiteral subject : subjectsAsJSONObjects.keySet()) {
-			String key = subjectsAsJSONObjects.get(subject);
-
-			JSONObject predicatesAsJSONObjects = new JSONObject();
-
-			Iterator<Triple> triplesFromSubject = tc
-					.filter(subject, null, null);
-			while (triplesFromSubject.hasNext()) {
-				UriRef predicate = triplesFromSubject.next()
-						.getPredicate();
-				JSONArray jsonValues = addValuesToJSONArray(tc, subject,
-						predicate, subjectsAsJSONObjects);
-				predicatesAsJSONObjects.put(predicate.getUnicodeString(),
-						jsonValues);
-			}
-			root.put(key, predicatesAsJSONObjects);
-		}
-		try {
-			serializedGraph.write(root.toJSONString().getBytes());
-		} catch (IOException ioe) {
-			logger.error(ioe.getMessage());
-			throw new RuntimeException(ioe.getMessage());
-		}
-	}
-
-	private Map<NonLiteral, String> createSubjectsAsJSONObjects(
-			TripleCollection tc) {
-		Map<NonLiteral, String> subjectsAsJSONObjects = new HashMap<NonLiteral, String>();
-		Iterator<Triple> triples = tc.iterator();
-		int bNodeCounter = 1;
-		while (triples.hasNext()) {
-			NonLiteral subject = triples.next().getSubject();
-			if (!subjectsAsJSONObjects.containsKey(subject)) {
-				if (subject instanceof UriRef) {
-					subjectsAsJSONObjects.put(subject, ((UriRef) subject)
-							.getUnicodeString());
-				} else if (subject instanceof BNode) {
-					subjectsAsJSONObjects.put(subject, "_:" + bNodeCounter++);
-				}
-			}
-		}
-		return subjectsAsJSONObjects;
-	}
-
-	private JSONArray addValuesToJSONArray(TripleCollection tc,
-			NonLiteral subject, UriRef predicate,
-			Map<NonLiteral, String> subjectsAsJSONObjects) {
-
-		JSONArray jsonValues = new JSONArray();
-
-		Iterator<Triple> objectsFromPredicate = tc.filter(subject, predicate,
-				null);
-		while (objectsFromPredicate.hasNext()) {
-			Resource object = objectsFromPredicate.next()
-					.getObject();
-			JSONObject objectAsJSONObject = new JSONObject();
-			if (object instanceof PlainLiteral) {
-				PlainLiteral plainLiteral = (PlainLiteral) object;
-				objectAsJSONObject.put("value", plainLiteral.getLexicalForm());
-				objectAsJSONObject.put("type", "literal");
-				if (plainLiteral.getLanguage() != null) {
-					objectAsJSONObject.put("lang", plainLiteral.getLanguage().toString());
-				}
-			} else if (object instanceof TypedLiteral) {
-				TypedLiteral literal = (TypedLiteral) object;
-				objectAsJSONObject.put("value", literal.getLexicalForm());
-				objectAsJSONObject.put("type", "literal");
-				objectAsJSONObject.put("datatype", literal.getDataType()
-						.getUnicodeString());
-			} else if (object instanceof UriRef) {
-				UriRef uri = (UriRef) object;
-				objectAsJSONObject.put("value", uri.getUnicodeString());
-				objectAsJSONObject.put("type", "uri");
-			} else if (object instanceof BNode) {
-				objectAsJSONObject.put("value", subjectsAsJSONObjects
-						.get(object));
-				objectAsJSONObject.put("type", "bnode");
-			}
-			jsonValues.add(objectAsJSONObject);
-		}
-		return jsonValues;
-	}
-}
+package org.apache.clerezza.rdf.rdfjson.serializer;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.clerezza.rdf.core.BNode;
+import org.apache.clerezza.rdf.core.NonLiteral;
+import org.apache.clerezza.rdf.core.PlainLiteral;
+import org.apache.clerezza.rdf.core.Resource;
+import org.apache.clerezza.rdf.core.Triple;
+import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.clerezza.rdf.core.TypedLiteral;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.serializedform.SerializingProvider;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+
+/**
+ * A {@link org.apache.clerezza.rdf.core.serializedform.SerializingProvider} for
+ * rdf/json
+ * 
+ * @author tio
+ * 
+ * @scr.component immediate="true"
+ * @scr.service 
+ *              interface="org.apache.clerezza.rdf.core.serializedform.SerializingProvider"
+ * 
+ */
+@SupportedFormat(SupportedFormat.RDF_JSON)
+public class RdfJsonSerializingProvider implements SerializingProvider {
+
+	private final Logger logger = LoggerFactory.getLogger(getClass());
+
+	@Override
+	public void serialize(OutputStream serializedGraph, TripleCollection tc,
+			String formatIdentifier) {
+		JSONObject root = new JSONObject();
+
+		Map<NonLiteral, String> subjectsAsJSONObjects = createSubjectsAsJSONObjects(tc);
+
+		for (NonLiteral subject : subjectsAsJSONObjects.keySet()) {
+			String key = subjectsAsJSONObjects.get(subject);
+
+			JSONObject predicatesAsJSONObjects = new JSONObject();
+
+			Iterator<Triple> triplesFromSubject = tc.filter(subject, null, null);
+			while (triplesFromSubject.hasNext()) {
+				UriRef predicate = triplesFromSubject.next().getPredicate();
+				JSONArray jsonValues = addValuesToJSONArray(tc, subject, predicate, subjectsAsJSONObjects);
+				predicatesAsJSONObjects.put(predicate.getUnicodeString(), jsonValues);
+			}
+			root.put(key, predicatesAsJSONObjects);
+		}
+		try {
+			serializedGraph.write(root.toJSONString().getBytes());
+		} catch (IOException ioe) {
+			logger.error(ioe.getMessage());
+			throw new RuntimeException(ioe.getMessage());
+		}
+	}
+
+	private Map<NonLiteral, String> createSubjectsAsJSONObjects(
+			TripleCollection tc) {
+		Map<NonLiteral, String> subjectsAsJSONObjects = new HashMap<NonLiteral, String>();
+		Iterator<Triple> triples = tc.iterator();
+		int bNodeCounter = 1;
+		while (triples.hasNext()) {
+			NonLiteral subject = triples.next().getSubject();
+			if (!subjectsAsJSONObjects.containsKey(subject)) {
+				if (subject instanceof UriRef) {
+					subjectsAsJSONObjects.put(subject, ((UriRef) subject).getUnicodeString());
+				} else if (subject instanceof BNode) {
+					subjectsAsJSONObjects.put(subject, "_:" + bNodeCounter++);
+				}
+			}
+		}
+		return subjectsAsJSONObjects;
+	}
+
+	private JSONArray addValuesToJSONArray(TripleCollection tc,
+			NonLiteral subject, UriRef predicate,
+			Map<NonLiteral, String> subjectsAsJSONObjects) {
+
+		JSONArray jsonValues = new JSONArray();
+
+		Iterator<Triple> objectsFromPredicate = tc.filter(subject, predicate, null);
+		while (objectsFromPredicate.hasNext()) {
+			Resource object = objectsFromPredicate.next().getObject();
+			JSONObject objectAsJSONObject = new JSONObject();
+			if (object instanceof PlainLiteral) {
+				PlainLiteral plainLiteral = (PlainLiteral) object;
+				objectAsJSONObject.put("value", plainLiteral.getLexicalForm());
+				objectAsJSONObject.put("type", "literal");
+				if (plainLiteral.getLanguage() != null) {
+					objectAsJSONObject.put("lang", plainLiteral.getLanguage().toString());
+				}
+			} else if (object instanceof TypedLiteral) {
+				TypedLiteral literal = (TypedLiteral) object;
+				objectAsJSONObject.put("value", literal.getLexicalForm());
+				objectAsJSONObject.put("type", "literal");
+				objectAsJSONObject.put("datatype", literal.getDataType().getUnicodeString());
+			} else if (object instanceof UriRef) {
+				UriRef uri = (UriRef) object;
+				objectAsJSONObject.put("value", uri.getUnicodeString());
+				objectAsJSONObject.put("type", "uri");
+			} else if (object instanceof BNode) {
+				objectAsJSONObject.put("value", subjectsAsJSONObjects.get(object));
+				objectAsJSONObject.put("type", "bnode");
+			}
+			jsonValues.add(objectAsJSONObject);
+		}
+		return jsonValues;
+	}
+}

Modified: incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParserProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParserProviderTest.java?rev=1073576&r1=1073575&r2=1073576&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParserProviderTest.java
(original)
+++ incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/java/org/apache/clerezza/rdf/rdfjson/parser/RdfJsonParserProviderTest.java
Wed Feb 23 01:44:46 2011
@@ -1,20 +1,18 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
  *
  *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.clerezza.rdf.rdfjson.parser;
 
@@ -23,22 +21,17 @@ import java.util.Iterator;
 
 import org.junit.Assert;
 import org.junit.Test;
-import org.apache.clerezza.rdf.core.Graph;
 import org.apache.clerezza.rdf.core.MGraph;
 import org.apache.clerezza.rdf.core.Triple;
 import org.apache.clerezza.rdf.core.UriRef;
 import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
 import org.apache.clerezza.rdf.core.serializedform.ParsingProvider;
 
-
-
-
 /**
  * @author tio
  */
 public class RdfJsonParserProviderTest {
 
-
 	@Test
 	public void testParser() {
 		ParsingProvider provider = new RdfJsonParsingProvider();
@@ -47,7 +40,7 @@ public class RdfJsonParserProviderTest {
 		provider.parse(deserializedMGraph, jsonIn, "application/rdf+json", null);
 		Assert.assertEquals(deserializedMGraph.size(), 6);
 		Iterator<Triple> triples = deserializedMGraph.filter(new UriRef("http://base/child1"),
null, null);
-		while(triples.hasNext()) {
+		while (triples.hasNext()) {
 			UriRef uri = triples.next().getPredicate();
 			Assert.assertEquals(uri.getUnicodeString(), "http://base/propertyB");
 		}

Modified: incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/java/org/apache/clerezza/rdf/rdfjson/serializer/RdfJsonSerializerProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/java/org/apache/clerezza/rdf/rdfjson/serializer/RdfJsonSerializerProviderTest.java?rev=1073576&r1=1073575&r2=1073576&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/java/org/apache/clerezza/rdf/rdfjson/serializer/RdfJsonSerializerProviderTest.java
(original)
+++ incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/java/org/apache/clerezza/rdf/rdfjson/serializer/RdfJsonSerializerProviderTest.java
Wed Feb 23 01:44:46 2011
@@ -1,20 +1,18 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
  *
  *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.clerezza.rdf.rdfjson.serializer;
 
@@ -24,7 +22,6 @@ import java.io.ByteArrayOutputStream;
 import org.junit.Assert;
 import org.junit.Test;
 import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Graph;
 import org.apache.clerezza.rdf.core.LiteralFactory;
 import org.apache.clerezza.rdf.core.MGraph;
 import org.apache.clerezza.rdf.core.UriRef;
@@ -49,21 +46,17 @@ public class RdfJsonSerializerProviderTe
 	private void initializeGraph() {
 		String baseUri = "http://base/";
 		mGraph = new SimpleMGraph();
-		mGraph.add(new TripleImpl(new UriRef(baseUri + "root"), new UriRef(
-				baseUri + "propertyA"), new PlainLiteralImpl("A")));
-		mGraph
-				.add(new TripleImpl(new UriRef(baseUri + "root"), new UriRef(
-						baseUri + "resourcePropertyB"), new UriRef(baseUri
-						+ "child1")));
-		mGraph.add(new TripleImpl(new UriRef(baseUri + "child1"), new UriRef(
-				baseUri + "propertyB"), new PlainLiteralImpl("B")));
+		mGraph.add(new TripleImpl(new UriRef(baseUri + "root"), new UriRef(baseUri + "propertyA"),
+				new PlainLiteralImpl("A")));
+		mGraph.add(new TripleImpl(new UriRef(baseUri + "root"), new UriRef(baseUri + "resourcePropertyB"),
+				new UriRef(baseUri + "child1")));
+		mGraph.add(new TripleImpl(new UriRef(baseUri + "child1"), new UriRef(baseUri + "propertyB"),
+				new PlainLiteralImpl("B")));
 		BNode bNode = new BNode();
-		mGraph.add(new TripleImpl(bNode, new UriRef(baseUri + "propertyC"),
-				new PlainLiteralImpl("C")));
+		mGraph.add(new TripleImpl(bNode, new UriRef(baseUri + "propertyC"), new PlainLiteralImpl("C")));
 		mGraph.add(new TripleImpl(bNode, new UriRef(baseUri + "propertyE"),
 				LiteralFactory.getInstance().createTypedLiteral("E")));
-		mGraph.add(new TripleImpl(new UriRef(baseUri + "root"), new UriRef(
-				baseUri + "resourcePropertyD"), bNode));
+		mGraph.add(new TripleImpl(new UriRef(baseUri + "root"), new UriRef(baseUri + "resourcePropertyD"),
bNode));
 	}
 
 	/*
@@ -77,8 +70,7 @@ public class RdfJsonSerializerProviderTe
 		provider.serialize(serializedGraph, mGraph.getGraph(),
 				"application/rdf+json");
 		ParsingProvider parsingProvider = new RdfJsonParsingProvider();
-		ByteArrayInputStream jsonIn = new ByteArrayInputStream(serializedGraph
-				.toByteArray());
+		ByteArrayInputStream jsonIn = new ByteArrayInputStream(serializedGraph.toByteArray());
 		MGraph deserializedMGraph = new SimpleMGraph();
 		parsingProvider.parse(deserializedMGraph, jsonIn, "application/rdf+json", null);
 		Assert.assertEquals(6, deserializedMGraph.size());

Modified: incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/resources/org/apache/clerezza/rdf/rdfjson/parser/test.json
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/resources/org/apache/clerezza/rdf/rdfjson/parser/test.json?rev=1073576&r1=1073575&r2=1073576&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/resources/org/apache/clerezza/rdf/rdfjson/parser/test.json
(original)
+++ incubator/clerezza/trunk/parent/rdf.rdfjson/src/test/resources/org/apache/clerezza/rdf/rdfjson/parser/test.json
Wed Feb 23 01:44:46 2011
@@ -7,7 +7,7 @@
 		"http://base/propertyC":[{"value":"C","type":"literal","lang":"en"}]
 		"http://base/propertyE":[{"value":"E","type":"literal","datatype":"http://www.w3.org/2001/XMLSchema#string"}]
 	},
-	
+
 	"http://base/root":	{
 		"http://base/propertyA":[{"value":"A","type":"literal"}],
 		"http://base/resourcePropertyB":[{"value":"http://base/child1","type":"uri"}],



Mime
View raw message