clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject clerezza-rdf-core git commit: Added additional test for impl.sparql
Date Thu, 26 Jan 2017 20:54:26 GMT
Repository: clerezza-rdf-core
Updated Branches:
  refs/heads/master 3da2f8bde -> d5f31ce0b


Added additional test for impl.sparql


Project: http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/commit/d5f31ce0
Tree: http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/tree/d5f31ce0
Diff: http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/diff/d5f31ce0

Branch: refs/heads/master
Commit: d5f31ce0b5a23fab7123e211f676d466dd540d1f
Parents: 3da2f8b
Author: Reto Gmuer <reto@apache.org>
Authored: Thu Jan 26 20:52:35 2017 +0000
Committer: Reto Gmuer <reto@apache.org>
Committed: Thu Jan 26 20:52:35 2017 +0000

----------------------------------------------------------------------
 .../commons/rdf/impl/sparql/Dadmin2Test.java    | 94 ++++++++++++++++++++
 .../rdf/impl/sparql/SparqlClientTest.java       |  5 --
 .../commons/rdf/impl/sparql/dadmin2.ttl         | 17 ++++
 report.xml                                      | 35 --------
 4 files changed, 111 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/d5f31ce0/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/Dadmin2Test.java
----------------------------------------------------------------------
diff --git a/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/Dadmin2Test.java
b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/Dadmin2Test.java
new file mode 100644
index 0000000..5b954c6
--- /dev/null
+++ b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/Dadmin2Test.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.clerezza.commons.rdf.impl.sparql;
+
+import com.hp.hpl.jena.query.DatasetAccessor;
+import com.hp.hpl.jena.query.DatasetAccessorFactory;
+import java.io.IOException;
+import java.net.ServerSocket;
+import org.apache.jena.fuseki.EmbeddedFusekiServer;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.Language;
+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.impl.utils.PlainLiteralImpl;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class Dadmin2Test {
+
+    final static int serverPort = findFreePort();
+    static EmbeddedFusekiServer server;
+
+    @BeforeClass
+    public static void prepare() throws IOException {
+        final String serviceURI = "http://localhost:" + serverPort + "/ds/data";
+        final DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
+        final InputStream in = Dadmin2Test.class.getResourceAsStream("dadmin2.ttl");
+        final Model m = ModelFactory.createDefaultModel();
+        String base = "http://example.org/";
+        m.read(in, base, "TURTLE");
+        server = EmbeddedFusekiServer.memTDB(serverPort, "/ds");//dataSet.getAbsolutePath());
+        server.start();
+        System.out.println("Started fuseki on port " + serverPort);
+        accessor.putModel(m);
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        server.stop();
+    }
+
+    @Test
+    public void graphSize() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        Assert.assertEquals("Graph not of the exepected size", 12, graph.size());
+    }
+
+    @Test
+    public void dump() {
+        final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
+        Serializer serializer = Serializer.getInstance();
+        serializer.serialize(System.out, graph, SupportedFormat.TURTLE);
+    }
+
+    public static int findFreePort() {
+        int port = 0;
+        try (ServerSocket server = new ServerSocket(0);) {
+            port = server.getLocalPort();
+        } catch (Exception e) {
+            throw new RuntimeException("unable to find a free port");
+        }
+        return port;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/d5f31ce0/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlClientTest.java
----------------------------------------------------------------------
diff --git a/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlClientTest.java
b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlClientTest.java
index 2977f4e..ff1d794 100644
--- a/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlClientTest.java
+++ b/impl.sparql/src/test/java/org/apache/clerezza/commons/rdf/impl/sparql/SparqlClientTest.java
@@ -23,15 +23,10 @@ import org.apache.jena.fuseki.EmbeddedFusekiServer;
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
 import java.io.InputStream;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
 import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
 import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/d5f31ce0/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/dadmin2.ttl
----------------------------------------------------------------------
diff --git a/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/dadmin2.ttl
b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/dadmin2.ttl
new file mode 100644
index 0000000..df46a1a
--- /dev/null
+++ b/impl.sparql/src/test/resources/org/apache/clerezza/commons/rdf/impl/sparql/dadmin2.ttl
@@ -0,0 +1,17 @@
+@prefix rdf:	<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix ns1:	<http://data.admin.ch/> .
+@prefix ns2:	<http://schema.org/> .
+ns1:apps	rdf:type	ns2:WebPage ;
+	ns2:hasPart	_:b10511 .
+@prefix ns3:	<http://schema.zazuko.com/site/> .
+ns1:apps	ns3:hasIntro	_:b10510 ;
+	ns3:hasMenu	_:b10509 .
+_:b10509	rdf:type	ns3:Menu ;
+	ns2:articleBody	"\n  <li><a href=\"http://data.admin.ch/datasets\" title=\"Available
Data\">Data</a></li>\n  <li><a href=\"http://data.admin.ch/apps\"
title=\"Applications\">Applications</a></li>\n  <li><a href=\"http://data.admin.ch/sparql\"
title=\"SPARQL Endpoint\">SPARQL</a></li>\n  <li><a title=\"About
the Portal\" href=\"http://data.admin.ch/about\">About the Portal</a></li>\n
 <li><a title=\"Contact Us\" href=\"http://data.admin.ch/contact\">Contact</a></li>\n"
.
+_:b10510	rdf:type	ns3:Intro ;
+	ns2:articleBody	"\n<p><a href=\"http://data.admin.ch/map/\">Sample application</a>
based on STATTAB-SDMX-01-2A01+2011 data. This visualization was made within the prototype
phase in colaboration with <a href=\"http://www.ti.bfh.ch/\">Berner Fachhochschule</a>.
There are currently no other STATPOP datasets available as RDF.</p>\n" ;
+	ns3:title	"Choropleth" .
+_:b10511	rdf:type	ns3:Footer ;
+	ns2:articleBody	"<p>Do you have questions about the Linked Data pilot portal? Contact
us via our\n<a title=\"github\" href=\"https://github.com/zazuko/fso-lod\">Github page</a>.</p>"
.
+@prefix xsd:	<http://www.w3.org/2001/XMLSchema#> .
+_:b10511	ns2:dateCreated	"2015-11-15+01:00"^^xsd:date .

http://git-wip-us.apache.org/repos/asf/clerezza-rdf-core/blob/d5f31ce0/report.xml
----------------------------------------------------------------------
diff --git a/report.xml b/report.xml
deleted file mode 100644
index d64d43c..0000000
--- a/report.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<dfxml xmloutputversion='1.0'>
-  <metadata 
-  xmlns='http://afflib.org/tcpflow/' 
-  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
-  xmlns:dc='http://purl.org/dc/elements/1.1/'>
-    <dc:type>Feature Extraction</dc:type>
-  </metadata>
-  <creator version='1.0'>
-    <program>TCPFLOW</program>
-    <version>1.4.4</version>
-    <build_environment>
-      <compiler>4.8.2 (4.8.2 20140110 (prerelease) [ibm/gcc-4_8-branch merged from
gcc-4_8-branch, revision 205847])</compiler>
-      <CPPFLAGS>-pthread -I/usr/local/include -D_FORTIFY_SOURCE=2 -DUTC_OFFSET=+0000
</CPPFLAGS>
-      <CFLAGS>-g   -pthread -g -O3 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -MD -D_FORTIFY_SOURCE=2 -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes
-Wshadow -Wwrite-strings -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef
-Wredundant-decls -Wdisabled-optimization -Wfloat-equal -Wmultichar -Wc++-compat -Wmissing-noreturn
-Wall -Wstrict-prototypes</CFLAGS>
-      <CXXFLAGS>-g -pthread -g -O3 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -std=c++11 -Wall -MD -D_FORTIFY_SOURCE=2 -Wpointer-arith -Wshadow
-Wwrite-strings -Wcast-align -Wredundant-decls -Wdisabled-optimization -Wfloat-equal -Wmultichar
-Wmissing-noreturn -Woverloaded-virtual -Wsign-promo -funit-at-a-time -Wstrict-null-sentinel
-Weffc++ </CXXFLAGS>
-      <LDFLAGS>-L/usr/local/lib -Wl,-Bsymbolic-functions -Wl,-z,relro</LDFLAGS>
-      <LIBS>-lpcap -lcairo -lfontconfig -lfreetype -lpixman-1 -lexpat  -lssl -lcrypto
-lz -lssl -lcrypto </LIBS>
-      <compilation_date>2014-01-13T17:14:40</compilation_date>
-      <library name="boost" version="105400"/>
-    </build_environment>
-    <execution_environment>
-      <os_sysname>Linux</os_sysname>
-      <os_release>3.13.0-45-generic</os_release>
-      <os_version>#74-Ubuntu SMP Tue Jan 13 19:36:28 UTC 2015</os_version>
-      <host>f3addd37b525</host>
-      <arch>x86_64</arch>
-      <command_line>tcpflow -i lo -c port 3333</command_line>
-      <uid>0</uid>
-      <start_time>2015-02-15T17:15:22Z</start_time>
-    </execution_environment>
-  </creator>
-  <configuration>
-  </configuration>
-  <tdelta>0</tdelta>


Mime
View raw message