Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id ABD38200C08 for ; Thu, 26 Jan 2017 21:54:28 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id AA55A160B4C; Thu, 26 Jan 2017 20:54:28 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CCCB6160B31 for ; Thu, 26 Jan 2017 21:54:27 +0100 (CET) Received: (qmail 96733 invoked by uid 500); 26 Jan 2017 20:54:27 -0000 Mailing-List: contact commits-help@clerezza.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@clerezza.apache.org Delivered-To: mailing list commits@clerezza.apache.org Received: (qmail 96724 invoked by uid 99); 26 Jan 2017 20:54:26 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jan 2017 20:54:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D9E79DFB0E; Thu, 26 Jan 2017 20:54:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: reto@apache.org To: commits@clerezza.apache.org Message-Id: <1474fe248d804e1c8fe4f1d8a4ffb4f4@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: clerezza-rdf-core git commit: Added additional test for impl.sparql Date: Thu, 26 Jan 2017 20:54:26 +0000 (UTC) archived-at: Thu, 26 Jan 2017 20:54:28 -0000 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 Authored: Thu Jan 26 20:52:35 2017 +0000 Committer: Reto Gmuer 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: . +@prefix ns1: . +@prefix ns2: . +ns1:apps rdf:type ns2:WebPage ; + ns2:hasPart _:b10511 . +@prefix ns3: . +ns1:apps ns3:hasIntro _:b10510 ; + ns3:hasMenu _:b10509 . +_:b10509 rdf:type ns3:Menu ; + ns2:articleBody "\n
  • Data
  • \n
  • Applications
  • \n
  • SPARQL
  • \n
  • About the Portal
  • \n
  • Contact
  • \n" . +_:b10510 rdf:type ns3:Intro ; + ns2:articleBody "\n

    Sample application based on STATTAB-SDMX-01-2A01+2011 data. This visualization was made within the prototype phase in colaboration with Berner Fachhochschule. There are currently no other STATPOP datasets available as RDF.

    \n" ; + ns3:title "Choropleth" . +_:b10511 rdf:type ns3:Footer ; + ns2:articleBody "

    Do you have questions about the Linked Data pilot portal? Contact us via our\nGithub page.

    " . +@prefix xsd: . +_: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 @@ - - - - Feature Extraction - - - TCPFLOW - 1.4.4 - - 4.8.2 (4.8.2 20140110 (prerelease) [ibm/gcc-4_8-branch merged from gcc-4_8-branch, revision 205847]) - -pthread -I/usr/local/include -D_FORTIFY_SOURCE=2 -DUTC_OFFSET=+0000 - -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 - -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++ - -L/usr/local/lib -Wl,-Bsymbolic-functions -Wl,-z,relro - -lpcap -lcairo -lfontconfig -lfreetype -lpixman-1 -lexpat -lssl -lcrypto -lz -lssl -lcrypto - 2014-01-13T17:14:40 - - - - Linux - 3.13.0-45-generic - #74-Ubuntu SMP Tue Jan 13 19:36:28 UTC 2015 - f3addd37b525 - x86_64 - tcpflow -i lo -c port 3333 - 0 - 2015-02-15T17:15:22Z - - - - - 0