You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2015/10/12 08:54:17 UTC
[1/6] marmotta git commit: Added the ValueExpr "Exists" to SQLBuilder
Repository: marmotta
Updated Branches:
refs/heads/MARMOTTA-584 e382dc911 -> d702f9eda
Added the ValueExpr "Exists" to SQLBuilder
SPARQL-Exists statements had no datatype assigned.
Added the ValueExpr "Exists" to SQLBuilder in order
to have proper ValueType on SPARQL-EXISTS statements when
using "native" sparql.strategy!
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/56bcb6d2
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/56bcb6d2
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/56bcb6d2
Branch: refs/heads/MARMOTTA-584
Commit: 56bcb6d299f6ec232f0b0fe82ef93697f91e4f0b
Parents: dd013be
Author: Dietmar <dg...@gmail.com>
Authored: Fri Sep 25 15:19:18 2015 +0200
Committer: Dietmar <dg...@gmail.com>
Committed: Fri Sep 25 15:19:18 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/marmotta/kiwi/sparql/builder/SQLBuilder.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/56bcb6d2/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/builder/SQLBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/builder/SQLBuilder.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/builder/SQLBuilder.java
index 933fdda..f816fa4 100644
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/builder/SQLBuilder.java
+++ b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/builder/SQLBuilder.java
@@ -897,6 +897,8 @@ public class SQLBuilder {
return ValueType.BOOL;
} else if(expr instanceof If) {
return getProjectionType(((If) expr).getResult());
+ } else if(expr instanceof Exists) {
+ return ValueType.BOOL;
} else {
return ValueType.STRING;
}
[3/6] marmotta git commit: added test for marmotta-618
Posted by wi...@apache.org.
added test for marmotta-618
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/ef38b465
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/ef38b465
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/ef38b465
Branch: refs/heads/MARMOTTA-584
Commit: ef38b4658ee0d3a38481cfaed21071be10951b66
Parents: a377e5e
Author: Dietmar <dg...@gmail.com>
Authored: Fri Oct 2 13:33:50 2015 +0200
Committer: Dietmar <dg...@gmail.com>
Committed: Fri Oct 2 13:33:50 2015 +0200
----------------------------------------------------------------------
.../commons/http/MarmottaHttpUtilsTest.java | 27 ++++++++++++++++++++
1 file changed, 27 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/ef38b465/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/http/MarmottaHttpUtilsTest.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/http/MarmottaHttpUtilsTest.java b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/http/MarmottaHttpUtilsTest.java
index 2c19b47..dffcefe 100644
--- a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/http/MarmottaHttpUtilsTest.java
+++ b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/http/MarmottaHttpUtilsTest.java
@@ -19,6 +19,8 @@ package org.apache.marmotta.commons.http;
import static org.junit.Assert.assertEquals;
+import java.util.List;
+
import org.junit.Test;
import com.google.common.collect.ImmutableList;
@@ -37,4 +39,29 @@ public class MarmottaHttpUtilsTest {
assertEquals(null, MarmottaHttpUtils.bestContentType(ImmutableList.of(new ContentType("text", "tutle")), ImmutableList.of(new ContentType("text", "plain"))));
}
+ @Test
+ public void testParseAcceptHeader() throws Exception {
+ List<ContentType> acceptedTypes = MarmottaHttpUtils.parseAcceptHeaders( ImmutableList.of(
+ "application/n-triples;q=0.7,"
+ + " text/plain;q=0.7,"
+ + " application/rdf+xml;q=0.8,"
+ + " application/xml;q=0.8,"
+ + " text/turtle,"
+ + " application/x-turtle,"
+ + " application/trig;q=0.8,"
+ + " application/x-trig;q=0.8"));
+ List<ContentType> offeredTypes = MarmottaHttpUtils.parseAcceptHeaders(ImmutableList.of(
+ "application/ld+json; q=1.0",
+ "application/x-turtle; q=1.0",
+ "application/x-trig; q=1.0",
+ "application/rdf+xml; q=1.0",
+ "text/turtle; q=1.0",
+ "text/rdf+n3; q=1.0",
+ "application/trix; q=1.0",
+ "application/rdf+json; q=1.0",
+ "text/n3; q=1.0",
+ "text/x-nquads; q=1.0"));
+ assertEquals(new ContentType("text", "turtle", 1.0), MarmottaHttpUtils.bestContentType(offeredTypes, acceptedTypes));
+
+ }
}
[4/6] marmotta git commit: MARMOTTA-617: added test
Posted by wi...@apache.org.
MARMOTTA-617: added test
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/732f4565
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/732f4565
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/732f4565
Branch: refs/heads/MARMOTTA-584
Commit: 732f45650a02f193f75398284b86045da06a3c68
Parents: dd013be
Author: Sergio Fernández <wi...@apache.org>
Authored: Fri Oct 9 14:48:47 2015 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Fri Oct 9 14:48:47 2015 +0200
----------------------------------------------------------------------
.../kiwi/sparql/test/KiWiSparqlTest.java | 36 +++++++++++++++--
.../kiwi/sparql/test/MARMOTTA-617.sparql | 28 +++++++++++++
.../marmotta/kiwi/sparql/test/MARMOTTA-617.ttl | 41 ++++++++++++++++++++
3 files changed, 101 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/732f4565/libraries/kiwi/kiwi-sparql/src/test/java/org/apache/marmotta/kiwi/sparql/test/KiWiSparqlTest.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/test/java/org/apache/marmotta/kiwi/sparql/test/KiWiSparqlTest.java b/libraries/kiwi/kiwi-sparql/src/test/java/org/apache/marmotta/kiwi/sparql/test/KiWiSparqlTest.java
index e346ce5..6f34750 100644
--- a/libraries/kiwi/kiwi-sparql/src/test/java/org/apache/marmotta/kiwi/sparql/test/KiWiSparqlTest.java
+++ b/libraries/kiwi/kiwi-sparql/src/test/java/org/apache/marmotta/kiwi/sparql/test/KiWiSparqlTest.java
@@ -36,9 +36,7 @@ import org.junit.*;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import org.junit.runner.RunWith;
-import org.openrdf.model.BNode;
-import org.openrdf.model.Statement;
-import org.openrdf.model.URI;
+import org.openrdf.model.*;
import org.openrdf.model.impl.URIImpl;
import org.openrdf.query.*;
import org.openrdf.query.impl.DatasetImpl;
@@ -137,7 +135,7 @@ public class KiWiSparqlTest {
* @throws Exception
*/
@Test
- public void testQuery37() throws Exception {
+ public void testMarmotta578() throws Exception {
testQuery("MARMOTTA-578.sparql");
}
@@ -252,4 +250,34 @@ public class KiWiSparqlTest {
}
+ @Test
+ public void testMarmotta617() throws Exception {
+ RepositoryConnection conn = repository.getConnection();
+ try {
+ conn.begin();
+
+ // 1) load demo data
+ conn.add(this.getClass().getResourceAsStream("MARMOTTA-617.ttl"), "http://localhost/test/MARMOTTA-617", RDFFormat.TURTLE);
+ conn.commit();
+
+ // 2) test the query behavior
+ String queryString = IOUtils.toString(this.getClass().getResourceAsStream("MARMOTTA-617.sparql"), "UTF-8");
+ TupleQuery query = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
+ TupleQueryResult results = query.evaluate();
+ try {
+ while (results.hasNext()) {
+ BindingSet bindingSet = results.next();
+ Assert.assertTrue(bindingSet.getValue("children") instanceof Literal);
+ Literal children = (Literal) bindingSet.getValue("children");
+ Assert.assertEquals("http://www.w3.org/2001/XMLSchema#boolean", children.getDatatype().stringValue());
+ Assert.assertTrue(Lists.newArrayList("true", "false").contains(children.stringValue()));
+ }
+ } finally {
+ results.close();
+ }
+ } finally {
+ conn.close();
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/732f4565/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/test/MARMOTTA-617.sparql
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/test/MARMOTTA-617.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/test/MARMOTTA-617.sparql
new file mode 100644
index 0000000..b0f847a
--- /dev/null
+++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/test/MARMOTTA-617.sparql
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+
+SELECT DISTINCT ?uri ?title ?children {
+ GRAPH <http://localhost/test/MARMOTTA-617> {
+ ?uri a <http://www.w3.org/2004/02/skos/core#ConceptScheme> .
+ OPTIONAL {
+ ?uri <http://www.w3.org/2000/01/rdf-schema#label> ?title .
+ FILTER (lang(?title) = 'en')
+ }
+ BIND ( EXISTS { ?uri <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?_top } AS ?children )
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/732f4565/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/test/MARMOTTA-617.ttl
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/test/MARMOTTA-617.ttl b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/test/MARMOTTA-617.ttl
new file mode 100644
index 0000000..91d0e6c
--- /dev/null
+++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/test/MARMOTTA-617.ttl
@@ -0,0 +1,41 @@
+#
+# 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 skos: <http://www.w3.org/2004/02/skos/core#> .
+@prefix : <http://example.org/vocabulary/> .
+
+:Vocabulary a skos:ConceptScheme;
+ skos:hasTopConcept :TopLevelConceptA;
+ skos:hasTopConcept :TopLevelConceptB;
+ rdfs:label "A simple Vocabulary"@en.
+
+:TopLevelConceptA a skos:Concept;
+ skos:inScheme :Vocabulary;
+ skos:topConceptOf :Vocabulary;
+ skos:prefLabel "Label Concept a"@en.
+
+:TopLevelConceptB a skos:Concept;
+ skos:inScheme :Vocabulary;
+ skos:topConceptOf :Vocabulary;
+ skos:narrower :NarrowerConceptB;
+ skos:prefLabel "Label Concept b"@en.
+
+:NarrowerConceptB a skos:Concept;
+ skos:inScheme :Vocabulary;
+ skos:broader :TopLevelConceptB;
+ skos:prefLabel "Label Concept b"@en.
[5/6] marmotta git commit: Merge branch 'develop' of
https://git-wip-us.apache.org/repos/asf/marmotta into develop
Posted by wi...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/marmotta into develop
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/b4d8c333
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/b4d8c333
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/b4d8c333
Branch: refs/heads/MARMOTTA-584
Commit: b4d8c333688b57474decc601f01daa41e025f983
Parents: 732f456 ef38b46
Author: Sergio Fernández <wi...@apache.org>
Authored: Fri Oct 9 14:51:24 2015 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Fri Oct 9 14:51:24 2015 +0200
----------------------------------------------------------------------
.../commons/http/MarmottaHttpUtils.java | 4 +--
.../commons/http/MarmottaHttpUtilsTest.java | 27 ++++++++++++++++++++
.../kiwi/sparql/builder/SQLBuilder.java | 2 ++
3 files changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[6/6] marmotta git commit: Merge branch 'develop' into MARMOTTA-584
Posted by wi...@apache.org.
Merge branch 'develop' into MARMOTTA-584
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/d702f9ed
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/d702f9ed
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/d702f9ed
Branch: refs/heads/MARMOTTA-584
Commit: d702f9edaab81572b99ade6f87f2eb0715628952
Parents: e382dc9 b4d8c33
Author: Sergio Fernández <wi...@apache.org>
Authored: Fri Oct 9 17:51:44 2015 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Fri Oct 9 17:51:44 2015 +0200
----------------------------------------------------------------------
.../commons/http/MarmottaHttpUtils.java | 4 +-
.../commons/http/MarmottaHttpUtilsTest.java | 27 +++++++++++++
.../kiwi/sparql/builder/SQLBuilder.java | 2 +
.../kiwi/sparql/test/KiWiSparqlTest.java | 36 +++++++++++++++--
.../kiwi/sparql/test/MARMOTTA-617.sparql | 28 +++++++++++++
.../marmotta/kiwi/sparql/test/MARMOTTA-617.ttl | 41 ++++++++++++++++++++
6 files changed, 132 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/d702f9ed/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/builder/SQLBuilder.java
----------------------------------------------------------------------
[2/6] marmotta git commit: MARMOTTA-618 - strip leading spaces from
header string!
Posted by wi...@apache.org.
MARMOTTA-618 - strip leading spaces from header string!
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/a377e5e0
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/a377e5e0
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/a377e5e0
Branch: refs/heads/MARMOTTA-584
Commit: a377e5e00b16a0b93f5baf1c7402d692b2ffc59b
Parents: 56bcb6d
Author: Dietmar <dg...@gmail.com>
Authored: Fri Oct 2 13:10:49 2015 +0200
Committer: Dietmar <dg...@gmail.com>
Committed: Fri Oct 2 13:10:49 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/marmotta/commons/http/MarmottaHttpUtils.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/a377e5e0/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/http/MarmottaHttpUtils.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/http/MarmottaHttpUtils.java b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/http/MarmottaHttpUtils.java
index 46f38f5..ceb3eee 100644
--- a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/http/MarmottaHttpUtils.java
+++ b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/http/MarmottaHttpUtils.java
@@ -128,8 +128,8 @@ public class MarmottaHttpUtils {
public static ContentType parseContentType(String c) {
if (StringUtils.isBlank(c)) return null;
-
- String mt[] = c.split(";");
+ // be sure to trim leading and trailing spaces
+ String mt[] = c.trim().split(";");
String[] tst = mt[0].split("/");