You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2015/04/23 22:41:18 UTC
[14/14] clerezza git commit: CLEREZZA-966: moved stable serializer to
rdf folder
CLEREZZA-966: moved stable serializer to rdf folder
Project: http://git-wip-us.apache.org/repos/asf/clerezza/repo
Commit: http://git-wip-us.apache.org/repos/asf/clerezza/commit/d7fb079c
Tree: http://git-wip-us.apache.org/repos/asf/clerezza/tree/d7fb079c
Diff: http://git-wip-us.apache.org/repos/asf/clerezza/diff/d7fb079c
Branch: refs/heads/master
Commit: d7fb079ce9b70353fbb64f746019f2ecad558841
Parents: 1436fc1
Author: Reto Gmuer <re...@apache.org>
Authored: Thu Apr 23 20:40:13 2015 +0000
Committer: Reto Gmuer <re...@apache.org>
Committed: Thu Apr 23 20:40:57 2015 +0000
----------------------------------------------------------------------
pom.xml | 1 -
rdf.stable.serializer/LICENSE | 201 -
rdf.stable.serializer/pom.xml | 82 -
.../stable/serializer/NTriplesSerializer.java | 184 -
.../serializer/StableSerializerProvider.java | 468 -
....rdf.core.serializedform.SerializingProvider | 1 -
.../serializer/DocumentationStabilityTest.java | 66 -
.../serializer/NTriplesSerializerTest.java | 91 -
.../serializer/StableSerializerGraphTest.java | 89 -
.../clerezza/rdf/stable/serializer/Talks.rdf | 4506 -----
.../rdf/stable/serializer/agenda_62.rdf | 2066 ---
.../stable/serializer/amp-in-url-test001.rdf | 61 -
.../clerezza/rdf/stable/serializer/css3deps.rdf | 165 -
.../rdf/stable/serializer/datatypes-test001.rdf | 50 -
.../rdf/stable/serializer/datatypes-test002.rdf | 48 -
.../stable/serializer/documentation-example.nt | 25 -
.../clerezza/rdf/stable/serializer/elvisimp.rdf | 860 -
.../clerezza/rdf/stable/serializer/images.xrdf | 15596 -----------------
.../clerezza/rdf/stable/serializer/libby.foaf | 581 -
.../serializer/rdf-charmod-literals-test001.rdf | 55 -
.../serializer/rdf-charmod-uris-test001.rdf | 55 -
.../serializer/rdf-charmod-uris-test002.rdf | 54 -
.../rdf/stable/serializer/xml-canon-test001.rdf | 49 -
rdf/pom.xml | 1 +
rdf/stable.serializer/LICENSE | 201 +
rdf/stable.serializer/pom.xml | 82 +
.../stable/serializer/NTriplesSerializer.java | 184 +
.../serializer/StableSerializerProvider.java | 468 +
....rdf.core.serializedform.SerializingProvider | 1 +
.../serializer/DocumentationStabilityTest.java | 66 +
.../serializer/NTriplesSerializerTest.java | 91 +
.../serializer/StableSerializerGraphTest.java | 89 +
.../clerezza/rdf/stable/serializer/Talks.rdf | 4506 +++++
.../rdf/stable/serializer/agenda_62.rdf | 2066 +++
.../stable/serializer/amp-in-url-test001.rdf | 61 +
.../clerezza/rdf/stable/serializer/css3deps.rdf | 165 +
.../rdf/stable/serializer/datatypes-test001.rdf | 50 +
.../rdf/stable/serializer/datatypes-test002.rdf | 48 +
.../stable/serializer/documentation-example.nt | 25 +
.../clerezza/rdf/stable/serializer/elvisimp.rdf | 860 +
.../clerezza/rdf/stable/serializer/images.xrdf | 15596 +++++++++++++++++
.../clerezza/rdf/stable/serializer/libby.foaf | 581 +
.../serializer/rdf-charmod-literals-test001.rdf | 55 +
.../serializer/rdf-charmod-uris-test001.rdf | 55 +
.../serializer/rdf-charmod-uris-test002.rdf | 54 +
.../rdf/stable/serializer/xml-canon-test001.rdf | 49 +
46 files changed, 25354 insertions(+), 25354 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d7fb079c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 9443a11..2897792 100644
--- a/pom.xml
+++ b/pom.xml
@@ -73,7 +73,6 @@
<module>rdf.enrichment</module>
<module>rdf.locking</module>
<module>rdf.rdfjson</module>
- <module>rdf.stable.serializer</module>
<module>shell</module>
<module>shell.felixshellcommand</module>
<module>bundledevtool</module>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d7fb079c/rdf.stable.serializer/LICENSE
----------------------------------------------------------------------
diff --git a/rdf.stable.serializer/LICENSE b/rdf.stable.serializer/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/rdf.stable.serializer/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d7fb079c/rdf.stable.serializer/pom.xml
----------------------------------------------------------------------
diff --git a/rdf.stable.serializer/pom.xml b/rdf.stable.serializer/pom.xml
deleted file mode 100644
index 69ddea9..0000000
--- a/rdf.stable.serializer/pom.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-<!--
-
- 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.
-
--->
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>clerezza</artifactId>
- <groupId>org.apache.clerezza</groupId>
- <version>7-SNAPSHOT</version>
- <relativePath>../parent</relativePath>
- </parent>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.stable.serializer</artifactId>
- <packaging>bundle</packaging>
- <version>1.0.0-SNAPSHOT</version>
- <name>Clerezza - RDF Stable Serializer</name>
- <description>A SerializingProvider that prodocues a stable output. This means
- if the graph to be serialized changes a little, then also the output
- changes a little.</description>
- <dependencies>
- <dependency>
- <groupId>org.apache.clerezza.commons-rdf</groupId>
- <artifactId>commons-rdf-api</artifactId>
- <version>0.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.core</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.jena.serializer</artifactId>
- <scope>test</scope>
- <version>1.0.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.jena.parser</artifactId>
- <scope>test</scope>
- <version>1.0.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.utils</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.6</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d7fb079c/rdf.stable.serializer/src/main/java/org/apache/clerezza/rdf/stable/serializer/NTriplesSerializer.java
----------------------------------------------------------------------
diff --git a/rdf.stable.serializer/src/main/java/org/apache/clerezza/rdf/stable/serializer/NTriplesSerializer.java b/rdf.stable.serializer/src/main/java/org/apache/clerezza/rdf/stable/serializer/NTriplesSerializer.java
deleted file mode 100644
index 0342bf6..0000000
--- a/rdf.stable.serializer/src/main/java/org/apache/clerezza/rdf/stable/serializer/NTriplesSerializer.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.stable.serializer;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.HashMap;
-
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.Literal;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.ontologies.XSD;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A serializer that can serialze RDF Graphs into N-Triples format.
- *
- * NOTE: This is a special purpose serializer to be used with
- * {@link org.apache.clerezza.rdf.stable.serializer.StableSerializerProvider}.
- * Instances are assumed to be short-lived and not used concurrently.
- *
- * @author Daniel Spicar (daniel.spicar@access.uzh.ch)
- */
-class NTriplesSerializer {
-
- private final Logger logger = LoggerFactory.getLogger(getClass());
-
- private long genSymCounter = 0;
- private HashMap<BlankNode, String> bNodeLabels;
-
- /**
- * Resets the counter to zero that constitutes
- * the numerical part of blank node labels.
- */
- void resetGenSymCounter() {
- genSymCounter = 0;
- }
-
- /**
- * Serializes a given Graph using the N-Triples format.
- *
- * @param os
- * An outputstream.
- * @param tc
- * the triples of the graph to be serialized.
- */
- void serialize(OutputStream os, Graph tc) {
- try {
- bNodeLabels = new HashMap<BlankNode, String>(tc.size() / 2);
-
- for (Triple t : tc) {
- if (t.getSubject() instanceof BlankNode) {
- os.write(serializeBlankNode((BlankNode) t.getSubject()).getBytes());
- } else {
- os.write(serializeIRI(
- (IRI) t.getSubject()).getBytes());
- }
-
- os.write((t.getPredicate().toString() + " ").getBytes());
-
- if (t.getObject() instanceof BlankNode) {
- os.write(serializeBlankNode((BlankNode) t.getObject()).getBytes());
- os.write(".\n".getBytes());
- } else {
- if (t.getObject() instanceof Literal) {
- os.write((serializeLiteral((Literal) t.getObject()) +
- ".\n").getBytes());
- } else {
- os.write((serializeIRI((IRI) t.getObject()) +
- ".\n").getBytes());
- }
- }
- }
- } catch (IOException ex) {
- logger.error("Exception while serializing graph: {}", ex);
- }
- }
-
- private String serializeIRI(IRI uriRef) {
- StringBuffer sb = new StringBuffer("<");
- escapeUtf8ToUsAscii(uriRef.getUnicodeString(), sb, true);
- sb.append("> ");
-
- return sb.toString() ;
- }
-
- private String serializeBlankNode(BlankNode bNode) {
- if (bNodeLabels.containsKey(bNode)) {
- return bNodeLabels.get(bNode) + " ";
- } else {
- String label = "_:b" + genSymCounter++;
- bNodeLabels.put(bNode, label);
- return label + " ";
- }
- }
-
- private String serializeLiteral(Literal literal) {
- StringBuffer sb = new StringBuffer("\"");
- escapeUtf8ToUsAscii(literal.getLexicalForm(), sb, false);
- sb = sb.append("\"");
-
- if(literal.getDataType().equals(XSD.string)) {
- if(literal.getLanguage() != null &&
- !literal.getLanguage().toString().equals("")) {
-
- sb.append("@");
- sb.append(literal.getLanguage().toString());
- }
- } else {
- sb.append("^^<");
- escapeUtf8ToUsAscii(
- literal.getDataType().getUnicodeString(), sb, false);
- sb.append(">");
- }
-
- sb.append(" ");
-
- return sb.toString() ;
- }
-
- private void escapeUtf8ToUsAscii(String input, StringBuffer sb, boolean uri) {
-
- for (int i = 0; i < input.length(); ++i) {
- char c = input.charAt(i);
- int val = (int) c;
- if (c == '\t') {
- sb.append("\\t");
- } else if (c == '\n') {
- sb.append("\\n");
- } else if (c == '\r') {
- sb.append("\\r");
- } else if (c == '"') {
- sb.append("\\\"");
- } else if (c == '\\') {
- sb.append("\\\\");
- } else if ((val >= 0x0 && val <= 0x8) || (val >= 0xB && val <= 0xC)
- || (val >= 0xE && val <= 0x1F)
- || (val >= 0x7F && val <= 0xFFFF)) {
- sb.append("\\u");
- sb.append(getIntegerHashString(val, 4));
- } else if (val >= 0x10000 && val <= 0x10FFFF) {
- sb.append("\\U");
- sb.append(getIntegerHashString(val, 8));
- } else {
- if (uri && (c == '>' || c == '<')) {
- sb.append("\\u");
- sb.append(getIntegerHashString(val, 4));
- } else {
- sb.append(c);
- }
- }
- }
- }
-
- private String getIntegerHashString(int val, int length) {
- StringBuffer sb = new StringBuffer();
- String hex = Integer.toHexString(val);
- for(int i = 0; i < length - hex.length(); ++i) {
- sb.append("0");
- }
- sb.append(hex);
-
- return sb.toString().toUpperCase();
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d7fb079c/rdf.stable.serializer/src/main/java/org/apache/clerezza/rdf/stable/serializer/StableSerializerProvider.java
----------------------------------------------------------------------
diff --git a/rdf.stable.serializer/src/main/java/org/apache/clerezza/rdf/stable/serializer/StableSerializerProvider.java b/rdf.stable.serializer/src/main/java/org/apache/clerezza/rdf/stable/serializer/StableSerializerProvider.java
deleted file mode 100644
index f25c5d3..0000000
--- a/rdf.stable.serializer/src/main/java/org/apache/clerezza/rdf/stable/serializer/StableSerializerProvider.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.stable.serializer;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.StringReader;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Literal;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.clerezza.rdf.core.serializedform.SerializingProvider;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.apache.clerezza.rdf.utils.GraphNode;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
-import org.osgi.service.component.ComponentContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/*
- * Credits:
- *
- * Blank node labeling algorithm by Jeremy J. Carroll (see "Signing RDF Graphs",
- * HP technical report 2003)
- *
- * Minimum Self-contained ImmutableGraph (MSG) decomposition algorithm by
- * Giovanni Tummarello, Christian Morbidoni, Paolo Puliti, Francesco Piazza,
- * Università Politecnica delle Marche, Italy
- * (see "Signing individual fragments of an RDF graph", 14th International
- * World Wide Web Conference WWW2005, Poster track, May 2005, Chiba, Japan)
- */
-
-/**
- * A {@link org.apache.clerezza.rdf.core.serializedform.SerializingProvider} that tries
- * to provide similar results when serializing graphs. Specifically it tries to
- * label blank nodes deterministically with reasonable complexity.
- *
- * This serializer does not guarantee a deterministic result but it may minimize
- * the amount of modified lines in serialized output.
- *
- * @author Daniel Spicar (daniel.spicar@access.uzh.ch)
- */
-@Component
-@Service(SerializingProvider.class)
-@SupportedFormat({SupportedFormat.N_TRIPLE})
-public class StableSerializerProvider implements SerializingProvider {
-
- @Property(description="Specifies maximum amount of blank nodes " +
- "labeling recursions, may increase performance at the expense of stability " +
- "(0 = no limit).", intValue=0)
- public static final String MAX_LABELING_ITERATIONS = "max_labeling_iterations";
-
- private int maxLabelingIterations = -1;
-
- private final Logger logger = LoggerFactory.getLogger(getClass());
-
- protected void activate(ComponentContext cCtx) {
- maxLabelingIterations = (Integer) cCtx.getProperties().
- get(MAX_LABELING_ITERATIONS);
- logger.info("StableSerializerProvider activated");
- }
-
- @Override
- public void serialize(OutputStream os, Graph tc,
- String formatIdentifier) {
-
- try {
- List<String> lines = new LinkedList<String>();
- List<MSG> msgs = decomposeGraphToMSGs(tc);
- NTriplesSerializer serializer = new NTriplesSerializer();
-
- computeMsgHashes(msgs, "MD5");
-
- for (MSG msg : msgs) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- serializer.serialize(baos, msg.tc);
- BufferedReader serializedGraph =
- new BufferedReader(new StringReader(baos.toString()));
- lines.addAll(labelBlankNodes(serializedGraph, msg.hash));
- }
-
- Collections.sort(lines);
- for (String l : lines) {
- os.write((l + "\n").getBytes());
- }
- } catch (IOException ex) {
- logger.error("Exception while parsing serialized graph: {}", ex);
- } catch (NoSuchAlgorithmException ex) {
- logger.error("Exception while trying to generate graph hash: {}", ex);
- }
- }
-
- private List<MSG> decomposeGraphToMSGs(Graph tc) {
-
- Graph tmp = new SimpleGraph();
- tmp.addAll(tc);
-
- List<MSG> msgSet = new LinkedList<MSG>();
-
- while (tmp.size() > 0) {
- Triple triple = tmp.iterator().next();
- Graph msgTc = new SimpleGraph();
-
- boolean containsBlankNode = fillMSG(triple, tmp, msgTc);
- MSG msg = new MSG(msgTc);
- msg.containsBlankNodes = containsBlankNode;
- msgSet.add(msg);
- }
-
- return msgSet;
- }
-
- private boolean fillMSG(Triple triple, Graph tc,
- Graph msg) {
-
- boolean containsBlankNode = false;
-
- RDFTerm resource = triple.getSubject();
- if (resource instanceof BlankNode) {
- containsBlankNode = true;
- } else {
- resource = triple.getObject();
- if (resource instanceof BlankNode) {
- containsBlankNode = true;
- }
- }
- if (containsBlankNode) {
- GraphNode gn = new GraphNode(resource, tc);
- ImmutableGraph context = gn.getNodeContext();
- msg.addAll(context);
- tc.removeAll(context);
- } else {
- msg.add(triple);
- tc.remove(triple);
- }
- return containsBlankNode;
- }
-
- private List<String> labelBlankNodes(BufferedReader serializedGraph,
- String prefix) throws IOException {
-
- String line = null;
- List<String> lines = new LinkedList<String>();
-
- long commentedIdentifiers = 0;
- while ((line = serializedGraph.readLine()) != null) {
- try {
- commentedIdentifiers = commentBlankNodeLabels(line,
- commentedIdentifiers, lines);
- } catch (IOException ex) {
- logger.error("Exception while trying to parse line: "
- + line + "\n{}", ex);
- }
- }
-
- Collections.sort(lines);
-
- Map<String, Long> labels = new HashMap<String, Long>();
- long[] counters = {1, commentedIdentifiers}; //counter[0] = genSymCounter
- long commentedIdentifierBefore;
- int ctr = 0;
- do {
- commentedIdentifierBefore = counters[1];
- counters = generateBlankNodeLabels(lines, labels, counters[0],
- counters[1], prefix);
- applyLabels(lines, labels, prefix);
- Collections.sort(lines);
- if(++ctr == maxLabelingIterations) {
- break;
- }
- } while (counters[1] > 0 && commentedIdentifierBefore != counters[1]);
-
- if (counters[1] > 0) {
- labelBlankNodesNonDeterministically(lines, counters, labels, prefix);
- }
-
- return lines;
- }
-
-
- private long[] generateBlankNodeLabels(List<String> lines,
- Map<String, Long> labels, long genSymCounter, long comments,
- String prefix) {
-
- for (int i = 1; i <= lines.size(); ++i) {
- StringBuilder previousLine = i > 1 ?new StringBuilder(lines.get(i - 2)) : new StringBuilder();
- StringBuilder currentLine = new StringBuilder(lines.get(i - 1));
- StringBuilder nextLine = new StringBuilder();
- if (i < lines.size()) {
- nextLine.append(lines.get(i));
- }
-
- String currentLineWithoutComments = stripComments(currentLine);
- if (stripComments(previousLine).equals(currentLineWithoutComments) ||
- stripComments(nextLine).equals(currentLineWithoutComments)) {
- continue;
- }
-
- int indexOfObject = checkObject(currentLineWithoutComments);
- if (indexOfObject != -1) {
- genSymCounter = applyGenSymIdentifier(labels, genSymCounter,
- currentLine, indexOfObject, prefix);
- --comments;
- }
-
- int indexOfSubject = checkSubject(currentLineWithoutComments);
- if (indexOfSubject != -1) {
- genSymCounter = applyGenSymIdentifier(labels, genSymCounter,
- currentLine, indexOfSubject, prefix);
- --comments;
- }
-
- lines.set(i - 1, currentLine.toString());
- }
-
- long[] result = {genSymCounter, comments};
- return result;
- }
-
- private void applyLabels(List<String> lines, Map<String, Long> labels,
- String prefix) {
-
- for (int i = 0; i < lines.size(); ++i) {
- StringBuilder line = new StringBuilder(lines.get(i));
-
- int indexOfObject = checkObject(stripComments(line));
- if (indexOfObject != -1) {
- int indexOfComment = line.lastIndexOf("#_:");
- String identifier =
- line.substring(indexOfComment + 1, line.length());
-
- if (labels.containsKey(identifier)) {
- line.delete(indexOfComment, line.length());
- line.delete(indexOfObject, indexOfObject + 1);
- line.insert(indexOfObject, "_:" + prefix +
- labels.get(identifier));
- }
- }
-
- int indexOfSubject = checkSubject(stripComments(line));
- if (indexOfSubject != -1) {
- int indexOfComment = line.lastIndexOf("#_:");
- String identifier =
- line.substring(indexOfComment + 1, line.length());
-
- if (labels.containsKey(identifier)) {
- line.delete(indexOfComment, line.length());
- line.delete(indexOfSubject, indexOfSubject + 1);
- line.insert(indexOfSubject, "_:" + prefix +
- labels.get(identifier));
- }
- }
-
- lines.set(i, line.toString());
- }
- }
-
- private long commentBlankNodeLabels(String line, long commentedIdentifiers,
- List<String> lines) throws IOException {
-
- StringReader lineReader = new StringReader(line);
- int data = lineReader.read();
- while (data != -1) {
- if (data == '<') {
- //skip until end tag
- while ((data = lineReader.read()) != '>') {
- checkForEndOfStream(data);
- }
- } else if (data == '"') {
- break;
- } else if (data == '_') {
- if ((data = lineReader.read()) == ':') {
- String identifier = "_:";
- while ((data = lineReader.read()) != ' ') {
- checkForEndOfStream(data);
- identifier = identifier.concat(
- Character.toString((char) data));
- }
- line = line.replaceFirst(identifier, "~");
- line = line.concat(" #" + identifier);
- ++commentedIdentifiers;
- checkForEndOfStream(data);
- }
- }
- data = lineReader.read();
- }
- lines.add(line);
- return commentedIdentifiers;
- }
-
- private long applyGenSymIdentifier(Map<String, Long> labels,
- long genSymCounter, StringBuilder currentLine, int where,
- String prefix) {
-
- int index = currentLine.lastIndexOf("#_:");
- String identifier =
- currentLine.substring(index + 1, currentLine.length()).trim();
- currentLine.delete(index, currentLine.length());
- if (!labels.containsKey(identifier)) {
- labels.put(identifier, genSymCounter++);
- }
- currentLine.delete(where, where + 1);
- currentLine.insert(where, "_:" + prefix + labels.get(identifier));
-
- return genSymCounter;
- }
-
- private void labelBlankNodesNonDeterministically(List<String> lines,
- long[] counters, Map<String, Long> labels, String prefix) {
-
- for (int i = 0; i < lines.size(); ++i) {
- StringBuilder currentLine = new StringBuilder(lines.get(i));
- String currentLineWithoutComments = stripComments(currentLine);
- int indexOfObject = checkObject(currentLineWithoutComments);
- if (indexOfObject != -1) {
- counters[0] = applyGenSymIdentifier(labels, counters[0],
- currentLine, indexOfObject, prefix);
- --(counters[1]);
- }
- int indexOfSubject = checkSubject(currentLineWithoutComments);
- if (indexOfSubject != -1) {
- counters[0] = applyGenSymIdentifier(labels, counters[0],
- currentLine, indexOfSubject, prefix);
- --(counters[1]);
- }
- lines.set(i, currentLine.toString());
- }
- Collections.sort(lines);
- }
-
- private void checkForEndOfStream(int data) throws IOException {
- if (data == -1) {
- throw new IOException("Parsing Error!");
- }
- }
-
- private int checkObject(String line) {
- int index = -1;
- if (line.charAt((index = line.length() - 3)) == '~') {
- return index;
- }
- return -1;
- }
-
- private int checkSubject(String line) {
- if (line.charAt(0) == '~') {
- return 0;
- }
- return -1;
- }
-
-
- private String stripComments(StringBuilder line) {
- if (line.length() < 3) {
- return "";
- }
- return line.substring(0, line.lastIndexOf(" .") + 2);
- }
-
- private void computeMsgHashes(List<MSG> msgs, String algorithm)
- throws NoSuchAlgorithmException {
-
- MessageDigest md = MessageDigest.getInstance(algorithm);
- HashSet<String> computedHashes = new HashSet<String>(msgs.size());
-
- for(MSG msg : msgs) {
- if(!msg.containsBlankNodes) {
- //hash is needed only for b-node labelling
- continue;
- }
- List<String> tripleHashes = new ArrayList<String>(msg.tc.size());
- for (Triple t : msg.tc) {
- StringBuilder tripleHash = new StringBuilder();
- if (!(t.getSubject() instanceof BlankNode)) {
- tripleHash.append(((IRI) t.getSubject()).hashCode());
- }
- tripleHash.append(t.getPredicate().hashCode());
- if (!(t.getObject() instanceof BlankNode)) {
- if (t.getObject() instanceof Literal) {
- tripleHash.append(((Literal) t.getObject()).
- toString().hashCode());
- } else {
- tripleHash.append(((IRI) t.getObject()).hashCode());
- }
- }
- tripleHashes.add(tripleHash.toString());
- }
- Collections.sort(tripleHashes);
- StringBuilder msgHash = new StringBuilder();
- for(String tripleHash : tripleHashes) {
- msgHash.append(tripleHash);
- }
-
- md.update(msgHash.toString().getBytes());
-
- String hexString;
- if(computedHashes.add((hexString = getHashHexString(md.digest())))){
- msg.hash = hexString;
- } else {
- md.update(String.valueOf(
- System.currentTimeMillis()).getBytes());
- while(!computedHashes.add(
- (hexString = getHashHexString(md.digest())))) {
- md.update(String.valueOf(
- System.currentTimeMillis()).getBytes());
- }
- msg.hash = hexString;
- }
- }
- }
-
- private String getHashHexString(byte[] hash) {
- StringBuilder hexString = new StringBuilder();
- for (int i = 0; i < hash.length; i++) {
- String hex = Integer.toHexString(0xFF & hash[i]);
- if (hex.length() == 1) {
- hexString.append('0');
- }
- hexString.append(hex);
- }
- return hexString.toString();
- }
-
- private static class MSG {
-
- final Graph tc;
- String hash = null;
- boolean containsBlankNodes = false;
-
- MSG(Graph tc) {
- this.tc = tc;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d7fb079c/rdf.stable.serializer/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.serializedform.SerializingProvider
----------------------------------------------------------------------
diff --git a/rdf.stable.serializer/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.serializedform.SerializingProvider b/rdf.stable.serializer/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.serializedform.SerializingProvider
deleted file mode 100644
index 8a9b397..0000000
--- a/rdf.stable.serializer/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.serializedform.SerializingProvider
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.clerezza.rdf.jena.serializer.JenaSerializerProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d7fb079c/rdf.stable.serializer/src/test/java/org/apache/clerezza/rdf/stable/serializer/DocumentationStabilityTest.java
----------------------------------------------------------------------
diff --git a/rdf.stable.serializer/src/test/java/org/apache/clerezza/rdf/stable/serializer/DocumentationStabilityTest.java b/rdf.stable.serializer/src/test/java/org/apache/clerezza/rdf/stable/serializer/DocumentationStabilityTest.java
deleted file mode 100644
index 5f511fa..0000000
--- a/rdf.stable.serializer/src/test/java/org/apache/clerezza/rdf/stable/serializer/DocumentationStabilityTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.stable.serializer;
-
-import java.io.ByteArrayOutputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.junit.Assert;
-import org.junit.Test;
-
-
-public class DocumentationStabilityTest {
-
- @Test
- public void RDFTestCases() throws Exception {
-
- Parser parser = Parser.getInstance();
- ImmutableGraph tc1 = parser.parse(
- getClass().getResourceAsStream("documentation-example.nt"), SupportedFormat.N_TRIPLE);
- final Set<String> lines1 = serializeToLines(tc1);
- Graph tc2 = new SimpleGraph();
- tc2.addAll(tc1);
- //add <bundle:///intro> <http://clerezza.org/2009/08/documentation#after> <bundle://org.apache.clerezza.platform.documentation/intro> .
- tc2.add(new TripleImpl(new IRI("bundle:///intro"),
- new IRI("http://clerezza.org/2009/08/documentation#after"),
- new IRI("bundle://org.apache.clerezza.platform.documentation/intro")));
- final Set<String> lines2 = serializeToLines(tc2);
- lines2.removeAll(lines1);
- Assert.assertEquals(1, lines2.size());
- }
-
- private Set<String> serializeToLines(Graph tc) throws UnsupportedEncodingException {
- StableSerializerProvider ssp = new StableSerializerProvider();
- final ByteArrayOutputStream os1 = new ByteArrayOutputStream();
- ssp.serialize(os1, tc, SupportedFormat.N_TRIPLE);
- return new HashSet<String>(Arrays.asList(new String(os1.toByteArray(), "utf-8").split("\n")));
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d7fb079c/rdf.stable.serializer/src/test/java/org/apache/clerezza/rdf/stable/serializer/NTriplesSerializerTest.java
----------------------------------------------------------------------
diff --git a/rdf.stable.serializer/src/test/java/org/apache/clerezza/rdf/stable/serializer/NTriplesSerializerTest.java b/rdf.stable.serializer/src/test/java/org/apache/clerezza/rdf/stable/serializer/NTriplesSerializerTest.java
deleted file mode 100644
index b3d3292..0000000
--- a/rdf.stable.serializer/src/test/java/org/apache/clerezza/rdf/stable/serializer/NTriplesSerializerTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.stable.serializer;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.Arrays;
-import java.util.Collection;
-
-import junit.framework.Assert;
-
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-/**
- *
- * @author daniel
- */
-@RunWith(Parameterized.class)
-public class NTriplesSerializerTest {
-
- private String inputFileName;
- private String format;
-
- public NTriplesSerializerTest(String inputFileName, String format) {
- this.inputFileName = inputFileName;
- this.format = format;
- }
-
- @Parameterized.Parameters
- public static Collection<String[]> inputFileNames() {
- return Arrays.asList(new String[][] {
- {"amp-in-url-test001.rdf", "application/rdf+xml"},
- {"datatypes-test001.rdf", "application/rdf+xml"},
- {"datatypes-test002.rdf", "application/rdf+xml"},
- {"rdf-charmod-literals-test001.rdf", "application/rdf+xml"},
- {"rdf-charmod-uris-test001.rdf", "application/rdf+xml"},
- {"rdf-charmod-uris-test002.rdf", "application/rdf+xml"},
- {"xml-canon-test001.rdf", "application/rdf+xml"},
- {"css3deps.rdf", "application/rdf+xml"},
- {"agenda_62.rdf", "application/rdf+xml"},
- {"Talks.rdf", "application/rdf+xml"},
- {"elvisimp.rdf", "application/rdf+xml"},
- //{"images.xrdf", "application/rdf+xml"}, //large
- {"libby.foaf", "application/rdf+xml"}
- });
- }
-
- @Test
- public void RDFTestCases() {
- NTriplesSerializer nts = new NTriplesSerializer();
-
- Parser parser = Parser.getInstance();
- ImmutableGraph deserializedGraphOld = parser.parse(
- getClass().getResourceAsStream(inputFileName), format);
-
- Graph tc = new SimpleGraph();
- tc.addAll(deserializedGraphOld);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- nts.serialize(baos, tc);
-
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
- ImmutableGraph deserializedGraphNew = parser.parse(bais, "application/n-triples");
-
- Assert.assertEquals(deserializedGraphNew, deserializedGraphOld);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d7fb079c/rdf.stable.serializer/src/test/java/org/apache/clerezza/rdf/stable/serializer/StableSerializerGraphTest.java
----------------------------------------------------------------------
diff --git a/rdf.stable.serializer/src/test/java/org/apache/clerezza/rdf/stable/serializer/StableSerializerGraphTest.java b/rdf.stable.serializer/src/test/java/org/apache/clerezza/rdf/stable/serializer/StableSerializerGraphTest.java
deleted file mode 100644
index 2637f8d..0000000
--- a/rdf.stable.serializer/src/test/java/org/apache/clerezza/rdf/stable/serializer/StableSerializerGraphTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.stable.serializer;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-/**
- *
- * @author daniel
- */
-@RunWith(Parameterized.class)
-public class StableSerializerGraphTest {
- private String inputFileName;
- private String format;
-
- public StableSerializerGraphTest(String inputFileName, String format) {
- this.inputFileName = inputFileName;
- this.format = format;
- }
-
- @Parameterized.Parameters
- public static Collection<String[]> inputFileNames() {
- return Arrays.asList(new String[][]{
- {"amp-in-url-test001.rdf", "application/rdf+xml"},
- {"datatypes-test001.rdf", "application/rdf+xml"},
- {"datatypes-test002.rdf", "application/rdf+xml"},
- {"rdf-charmod-literals-test001.rdf", "application/rdf+xml"},
- {"rdf-charmod-uris-test001.rdf", "application/rdf+xml"},
- {"rdf-charmod-uris-test002.rdf", "application/rdf+xml"},
- {"xml-canon-test001.rdf", "application/rdf+xml"},
- {"css3deps.rdf", "application/rdf+xml"},
- {"agenda_62.rdf", "application/rdf+xml"},
- {"Talks.rdf", "application/rdf+xml"},
- {"elvisimp.rdf", "application/rdf+xml"},
- //{"images.xrdf", "application/rdf+xml"}, //large
- {"libby.foaf", "application/rdf+xml"}
- });
- }
-
- @Test
- public void RDFTestCases() {
- StableSerializerProvider ssp = new StableSerializerProvider();
-
- Parser parser = Parser.getInstance();
- ImmutableGraph deserializedGraphOld = parser.parse(
- getClass().getResourceAsStream(inputFileName), format);
-
- Graph tc = new SimpleGraph();
- tc.addAll(deserializedGraphOld);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ssp.serialize(baos, tc, "application/n-triples");
-
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
- ImmutableGraph deserializedGraphNew = parser.parse(bais, "application/n-triples");
-
- Assert.assertEquals(deserializedGraphOld, deserializedGraphNew);
-
- }
-}