You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2014/02/27 17:38:35 UTC
[02/10] MARMOTTA-440: Moved rdf-patch to a separate module
(marmotta-utils-rdfpatch)
http://git-wip-us.apache.org/repos/asf/marmotta/blob/2a509e76/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/patch/parser/RdfPatchParserImplTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/patch/parser/RdfPatchParserImplTest.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/patch/parser/RdfPatchParserImplTest.java
deleted file mode 100644
index 9b9be1f..0000000
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/patch/parser/RdfPatchParserImplTest.java
+++ /dev/null
@@ -1,100 +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.marmotta.platform.ldp.patch.parser;
-
-import org.apache.marmotta.commons.vocabulary.FOAF;
-import org.apache.marmotta.platform.ldp.patch.model.PatchLine;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.openrdf.model.*;
-import org.openrdf.model.impl.LiteralImpl;
-import org.openrdf.model.impl.URIImpl;
-
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Testing the RdfPatchParserImpl
- *
- * @author Jakob Frank
- */
-public class RdfPatchParserImplTest {
-
-
- private RdfPatchParserImpl parser;
- private URI alice, bob, charlie;
- private Literal lcBob, ucBob;
-
- @Before
- public void setUp() {
- parser = new RdfPatchParserImpl(this.getClass().getResourceAsStream("/illustrative.rdfp"));
-
- alice = new URIImpl("http://example/alice");
- bob = new URIImpl("http://example/bob");
- charlie = new URIImpl("http://example/charlie");
-
- lcBob = new LiteralImpl("bob");
- ucBob = new LiteralImpl("Bob");
- }
-
- @After
- public void tearDown() {
- parser = null;
- }
-
-
- @Test
- public void testParsing() throws ParseException {
- List<PatchLine> patchLines = parser.parsePatch();
-
- Iterator<PatchLine> it = patchLines.iterator();
-
- Assert.assertTrue(it.hasNext());
- checkPatchLine(it.next(), PatchLine.Operator.DELETE, bob, FOAF.name, lcBob);
-
- Assert.assertTrue(it.hasNext());
- checkPatchLine(it.next(), PatchLine.Operator.ADD, bob, FOAF.name, ucBob);
-
- Assert.assertTrue(it.hasNext());
- checkPatchLine(it.next(), PatchLine.Operator.ADD, null, FOAF.knows, alice);
-
- Assert.assertTrue(it.hasNext());
- checkPatchLine(it.next(), PatchLine.Operator.DELETE, null, null, charlie);
- }
-
- private void checkPatchLine(PatchLine line, PatchLine.Operator operator, Resource subejct, URI predicate, Value object) {
- Assert.assertEquals("Wrong patch operation", operator, line.getOperator());
-
- Statement statement = line.getStatement();
- Assert.assertEquals("Wrong subject", subejct, statement.getSubject());
- Assert.assertEquals("Wrong predicate", predicate, statement.getPredicate());
- Assert.assertEquals("Wrong object", object, statement.getObject());
- }
-
- @Test
- public void testFullParsing() throws ParseException {
- parser.ReInit(getClass().getResourceAsStream("/rdf-patch.rdfp"));
-
- List<PatchLine> patchLines = parser.parsePatch();
- Assert.assertNotNull(patchLines);
- Assert.assertEquals(22, patchLines.size());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/2a509e76/platform/marmotta-ldp/src/test/resources/illustrative.in.ttl
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/resources/illustrative.in.ttl b/platform/marmotta-ldp/src/test/resources/illustrative.in.ttl
deleted file mode 100644
index d52213a..0000000
--- a/platform/marmotta-ldp/src/test/resources/illustrative.in.ttl
+++ /dev/null
@@ -1,28 +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.
-#
-@prefix foaf: <http://xmlns.com/foaf/0.1/> .
-
-<http://example/bob> a foaf:Person;
- foaf:name "bob" ;
- foaf:knows <http://example/charlie>.
-
-<http://example/alice> a foaf:Person;
- foaf:name "Alice" .
-
-<http://example/charlie> a foaf:Person;
- foaf:name "Charlie" .
http://git-wip-us.apache.org/repos/asf/marmotta/blob/2a509e76/platform/marmotta-ldp/src/test/resources/illustrative.rdfp
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/resources/illustrative.rdfp b/platform/marmotta-ldp/src/test/resources/illustrative.rdfp
deleted file mode 100644
index e5c0ab9..0000000
--- a/platform/marmotta-ldp/src/test/resources/illustrative.rdfp
+++ /dev/null
@@ -1,25 +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.
-#
-@prefix foaf: <http://xmlns.com/foaf/0.1/> .
-# Fix Bobs name
-D <http://example/bob> foaf:name "bob" .
-A <http://example/bob> foaf:name "Bob" .
-# At ApacheCon EU, Bob met Alice
-A R foaf:knows <http://example/alice> .
-# Bob and Charlie had a fight
-D R R <http://example/charlie> .
http://git-wip-us.apache.org/repos/asf/marmotta/blob/2a509e76/platform/marmotta-ldp/src/test/resources/rdf-patch.rdfp
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/resources/rdf-patch.rdfp b/platform/marmotta-ldp/src/test/resources/rdf-patch.rdfp
deleted file mode 100644
index 25d4829..0000000
--- a/platform/marmotta-ldp/src/test/resources/rdf-patch.rdfp
+++ /dev/null
@@ -1,98 +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.
-#
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
-@prefix dcterms: <http://purl.org/dc/terms/>.
-@prefix skos: <http://www.w3.org/2004/02/skos/core#>.
-@prefix foaf: <http://xmlns.com/foaf/0.1/>.
-@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
-@prefix ex: <http://example/test/>.
-
-# 3 full uris
-D <http://example/test/a> <http://example/test/b> <http://example/test/c> .
-A <http://example/test/a> <http://example/test/b> <http://example/test/c> .
-
-# Repeats
-A <http://example/test/a> <http://example/test/b> <http://example/test/c> .
-A R <http://example/test/b> <http://example/test/c> .
-A R R <http://example/test/c> .
-D R R <http://example/test/d> .
-A <http://example/test/a> R <http://example/test/c> .
-A <http://example/test/b> R R .
-A R <http://example/test/b> R .
-
-# QNAME / CURL
-D ex:a ex:b ex:c .
-A ex:a ex:b ex:c .
-
-# BNODE
-D _:b1 ex:b _:b2 .
-A _:b1 ex:b _:b2 .
-
-# Plain literal
-D ex:l dcterms:title "plain literal" .
-A ex:l dcterms:title "plain literal with excapte \"quote\"" .
-
-# Language literal
-D ex:ll dcterms:description "Deutsch"@de .
-A ex:ll dcterms:description "German"@en .
-
-# Typed literal
-D ex:tl dcterms:modified "2014-02-01T15:12:51.000Z"^^xsd:dateTime .
-A ex:tl dcterms:modified "2014-02-26T15:12:55.000Z"^^<http://www.w3.org/2001/XMLSchema#xsd:dateTime> .
-
-# LongString
-D ex:long dcterms:license """
-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.
-""" .
-
-A ex:long dcterms:license """
-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.
-"""^^ex:License .
-
-A ex:long dcterms:description """
-Every Software requires a licese.
-"""@en .