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 2013/11/05 11:52:18 UTC
[13/52] [partial] Reverting the erroneous merge by Sebastian
according to the instructions in INFRA-6876
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/create_ldcache_tables.sql
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/create_ldcache_tables.sql b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/create_ldcache_tables.sql
index 05a4b7c..08b2276 100644
--- a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/create_ldcache_tables.sql
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/create_ldcache_tables.sql
@@ -20,6 +20,7 @@ CREATE TABLE ldcache_entries (
expires_at timestamp NOT NULL,
resource_id bigint NOT NULL REFERENCES nodes(id),
update_count int NOT NULL DEFAULT 0,
+ triple_count int NOT NULL DEFAULT 0,
PRIMARY KEY(id)
);
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/statements.properties
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/statements.properties b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/statements.properties
index 8abd8c1..e8af848 100644
--- a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/statements.properties
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/statements.properties
@@ -19,13 +19,13 @@
# get sequence numbers
seq.ldcache = SELECT nextval('seq_ldcache')
-load.entry_by_id = SELECT id,retrieved_at,expires_at,resource_id,update_count FROM ldcache_entries WHERE id = ?
-load.entry_by_uri = SELECT E.id,retrieved_at,expires_at,resource_id,update_count FROM ldcache_entries E, nodes N WHERE e.resource_id = N.id AND N.ntype = 'uri' and N.svalue = ?
+load.entry_by_id = SELECT id,retrieved_at,expires_at,resource_id,update_count,triple_count FROM ldcache_entries WHERE id = ?
+load.entry_by_uri = SELECT E.id,retrieved_at,expires_at,resource_id,update_count,triple_count FROM ldcache_entries E, nodes N WHERE e.resource_id = N.id AND N.ntype = 'uri' and N.svalue = ?
# store ldcache entry information
-store.entry = INSERT INTO ldcache_entries (id,retrieved_at,expires_at,resource_id,update_count) VALUES (?,?,?,?,?)
+store.entry = INSERT INTO ldcache_entries (id,retrieved_at,expires_at,resource_id,update_count,triple_count) VALUES (?,?,?,?,?,?)
delete.entry = DELETE FROM ldcache_entries WHERE id = ?
delete.entry_by_uri = DELETE FROM ldcache_entries WHERE resource_id IN (SELECT id FROM nodes WHERE ntype='uri' AND svalue = ?)
-query.entries_expired = SELECT id,retrieved_at,expires_at,resource_id,update_count FROM ldcache_entries WHERE expires_at < now() ORDER BY retrieved_at ASC
-query.entries_all = SELECT id,retrieved_at,expires_at,resource_id,update_count FROM ldcache_entries ORDER BY retrieved_at ASC
+query.entries_expired = SELECT id,retrieved_at,expires_at,resource_id,update_count,triple_count FROM ldcache_entries WHERE expires_at < now() ORDER BY retrieved_at ASC
+query.entries_all = SELECT id,retrieved_at,expires_at,resource_id,update_count,triple_count FROM ldcache_entries ORDER BY retrieved_at ASC
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/upgrade_ldcache_001_002.sql
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/upgrade_ldcache_001_002.sql b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/upgrade_ldcache_001_002.sql
new file mode 100644
index 0000000..d9b9966
--- /dev/null
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/upgrade_ldcache_001_002.sql
@@ -0,0 +1,19 @@
+-- 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.
+
+ALTER TABLE ldcache_entries ADD COLUMN triple_count int NOT NULL DEFAULT 0;
+UPDATE
+ ldcache_entries
+SET triple_count = (SELECT count(*) as numTriples FROM triples WHERE subject = ldcache_entries.resource_id and deleted = false)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/create_ldcache_tables.sql
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/create_ldcache_tables.sql b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/create_ldcache_tables.sql
index c9d6e3b..b1717af 100644
--- a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/create_ldcache_tables.sql
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/create_ldcache_tables.sql
@@ -21,6 +21,7 @@ CREATE TABLE ldcache_entries (
expires_at timestamp NOT NULL,
resource_id bigint NOT NULL REFERENCES nodes(id),
update_count int NOT NULL DEFAULT 0,
+ triple_count int NOT NULL DEFAULT 0,
PRIMARY KEY(id)
);
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/statements.properties
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/statements.properties b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/statements.properties
index 6a0ee54..95faac7 100644
--- a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/statements.properties
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/statements.properties
@@ -19,14 +19,15 @@
# get sequence numbers
seq.ldcache.prep = UPDATE seq_ldcache SET id=LAST_INSERT_ID(id+1);
seq.ldcache = SELECT LAST_INSERT_ID();
+seq.ldcache.set = UPDATE seq_ldcache SET id=?;
-load.entry_by_id = SELECT id,retrieved_at,expires_at,resource_id,update_count FROM ldcache_entries WHERE id = ?
-load.entry_by_uri = SELECT E.id,retrieved_at,expires_at,resource_id,update_count FROM ldcache_entries E, nodes N WHERE e.resource_id = N.id AND N.ntype = 'uri' and N.svalue = ?
+load.entry_by_id = SELECT id,retrieved_at,expires_at,resource_id,update_count,triple_count FROM ldcache_entries WHERE id = ?
+load.entry_by_uri = SELECT E.id,retrieved_at,expires_at,resource_id,update_count,triple_count FROM ldcache_entries E, nodes N WHERE e.resource_id = N.id AND N.ntype = 'uri' and N.svalue = ?
# store ldcache entry information
-store.entry = INSERT INTO ldcache_entries (id,retrieved_at,expires_at,resource_id,update_count) VALUES (?,?,?,?,?)
+store.entry = INSERT INTO ldcache_entries (id,retrieved_at,expires_at,resource_id,update_count,triple_count) VALUES (?,?,?,?,?,?)
delete.entry = DELETE FROM ldcache_entries WHERE id = ?
delete.entry_by_uri = DELETE FROM ldcache_entries WHERE resource_id IN (SELECT id FROM nodes WHERE ntype='uri' AND svalue = ?)
-query.entries_expired = SELECT id,retrieved_at,expires_at,resource_id,update_count FROM ldcache_entries WHERE expires_at < now() ORDER BY retrieved_at ASC
-query.entries_all = SELECT id,retrieved_at,expires_at,resource_id,update_count FROM ldcache_entries ORDER BY retrieved_at ASC
+query.entries_expired = SELECT id,retrieved_at,expires_at,resource_id,update_count,triple_count FROM ldcache_entries WHERE expires_at < now() ORDER BY retrieved_at ASC
+query.entries_all = SELECT id,retrieved_at,expires_at,resource_id,update_count,triple_count FROM ldcache_entries ORDER BY retrieved_at ASC
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/upgrade_ldcache_001_002.sql
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/upgrade_ldcache_001_002.sql b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/upgrade_ldcache_001_002.sql
new file mode 100644
index 0000000..d9b9966
--- /dev/null
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/upgrade_ldcache_001_002.sql
@@ -0,0 +1,19 @@
+-- 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.
+
+ALTER TABLE ldcache_entries ADD COLUMN triple_count int NOT NULL DEFAULT 0;
+UPDATE
+ ldcache_entries
+SET triple_count = (SELECT count(*) as numTriples FROM triples WHERE subject = ldcache_entries.resource_id and deleted = false)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/create_ldcache_tables.sql
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/create_ldcache_tables.sql b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/create_ldcache_tables.sql
index 05a4b7c..08b2276 100644
--- a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/create_ldcache_tables.sql
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/create_ldcache_tables.sql
@@ -20,6 +20,7 @@ CREATE TABLE ldcache_entries (
expires_at timestamp NOT NULL,
resource_id bigint NOT NULL REFERENCES nodes(id),
update_count int NOT NULL DEFAULT 0,
+ triple_count int NOT NULL DEFAULT 0,
PRIMARY KEY(id)
);
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/statements.properties
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/statements.properties b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/statements.properties
index 8abd8c1..d6cbb1f 100644
--- a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/statements.properties
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/statements.properties
@@ -18,14 +18,15 @@
# get sequence numbers
seq.ldcache = SELECT nextval('seq_ldcache')
+seq.ldcache.set = SELECT setval('seq_ldcache',?)
-load.entry_by_id = SELECT id,retrieved_at,expires_at,resource_id,update_count FROM ldcache_entries WHERE id = ?
-load.entry_by_uri = SELECT E.id,retrieved_at,expires_at,resource_id,update_count FROM ldcache_entries E, nodes N WHERE e.resource_id = N.id AND N.ntype = 'uri' and N.svalue = ?
+load.entry_by_id = SELECT id,retrieved_at,expires_at,resource_id,update_count,triple_count FROM ldcache_entries WHERE id = ?
+load.entry_by_uri = SELECT E.id,retrieved_at,expires_at,resource_id,update_count,triple_count FROM ldcache_entries E, nodes N WHERE e.resource_id = N.id AND N.ntype = 'uri' and N.svalue = ?
# store ldcache entry information
-store.entry = INSERT INTO ldcache_entries (id,retrieved_at,expires_at,resource_id,update_count) VALUES (?,?,?,?,?)
+store.entry = INSERT INTO ldcache_entries (id,retrieved_at,expires_at,resource_id,update_count,triple_count) VALUES (?,?,?,?,?,?)
delete.entry = DELETE FROM ldcache_entries WHERE id = ?
delete.entry_by_uri = DELETE FROM ldcache_entries WHERE resource_id IN (SELECT id FROM nodes WHERE ntype='uri' AND svalue = ?)
-query.entries_expired = SELECT id,retrieved_at,expires_at,resource_id,update_count FROM ldcache_entries WHERE expires_at < now() ORDER BY retrieved_at ASC
-query.entries_all = SELECT id,retrieved_at,expires_at,resource_id,update_count FROM ldcache_entries ORDER BY retrieved_at ASC
+query.entries_expired = SELECT id,retrieved_at,expires_at,resource_id,update_count,triple_count FROM ldcache_entries WHERE expires_at < now() ORDER BY retrieved_at ASC
+query.entries_all = SELECT id,retrieved_at,expires_at,resource_id,update_count,triple_count FROM ldcache_entries ORDER BY retrieved_at ASC
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_ldcache_001_002.sql
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_ldcache_001_002.sql b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_ldcache_001_002.sql
new file mode 100644
index 0000000..d9b9966
--- /dev/null
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_ldcache_001_002.sql
@@ -0,0 +1,19 @@
+-- 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.
+
+ALTER TABLE ldcache_entries ADD COLUMN triple_count int NOT NULL DEFAULT 0;
+UPDATE
+ ldcache_entries
+SET triple_count = (SELECT count(*) as numTriples FROM triples WHERE subject = ldcache_entries.resource_id and deleted = false)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCacheBackendTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCacheBackendTest.java b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCacheBackendTest.java
index bfd12c9..e0ab3e8 100644
--- a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCacheBackendTest.java
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCacheBackendTest.java
@@ -18,7 +18,7 @@
package org.apache.marmotta.ldcache.backend.kiwi.test;
import info.aduna.iteration.CloseableIteration;
-import org.apache.commons.lang.RandomStringUtils;
+import org.apache.commons.lang3.RandomStringUtils;
import org.apache.marmotta.kiwi.persistence.KiWiDialect;
import org.apache.marmotta.kiwi.persistence.h2.H2Dialect;
import org.apache.marmotta.kiwi.persistence.mysql.MySQLDialect;
@@ -249,9 +249,12 @@ public class LDCacheBackendTest {
entry1.setLastRetrieved(new Date());
entry1.setUpdateCount(1);
entry1.setResource(subject1);
+ entry1.setTripleCount(1);
con.addCacheEntry(subject1, entry1);
con.commit();
+ Assert.assertTrue(backend.isCached(subject1.stringValue()));
+ Assert.assertFalse(backend.isCached(subject2.stringValue()));
Assert.assertEquals(1,asList(backend.listCacheEntries()).size());
Assert.assertEquals(0,asList(backend.listExpiredEntries()).size());
@@ -261,10 +264,13 @@ public class LDCacheBackendTest {
entry2.setLastRetrieved(new Date());
entry2.setUpdateCount(1);
entry2.setResource(subject2);
+ entry2.setTripleCount(1);
con.addCacheEntry(subject2,entry2);
con.commit();
+ Assert.assertTrue(backend.isCached(subject1.stringValue()));
+ Assert.assertTrue(backend.isCached(subject2.stringValue()));
Assert.assertEquals(2,asList(backend.listCacheEntries()).size());
Assert.assertEquals(1,asList(backend.listExpiredEntries()).size());
@@ -272,6 +278,8 @@ public class LDCacheBackendTest {
con.removeCacheEntry(subject1);
con.commit();
+ Assert.assertFalse(backend.isCached(subject1.stringValue()));
+ Assert.assertTrue(backend.isCached(subject2.stringValue()));
Assert.assertEquals(1,asList(backend.listCacheEntries()).size());
Assert.assertEquals(1,asList(backend.listExpiredEntries()).size());
} catch(RepositoryException ex) {
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCachePersistenceTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCachePersistenceTest.java b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCachePersistenceTest.java
index c25f166..d066405 100644
--- a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCachePersistenceTest.java
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCachePersistenceTest.java
@@ -18,7 +18,7 @@
package org.apache.marmotta.ldcache.backend.kiwi.test;
import info.aduna.iteration.CloseableIteration;
-import org.apache.commons.lang.RandomStringUtils;
+import org.apache.commons.lang3.RandomStringUtils;
import org.apache.marmotta.kiwi.model.rdf.KiWiUriResource;
import org.apache.marmotta.kiwi.persistence.KiWiDialect;
import org.apache.marmotta.kiwi.persistence.KiWiPersistence;
@@ -136,6 +136,7 @@ public class LDCachePersistenceTest {
@Before
public void initDatabase() throws SQLException {
persistence = new KiWiPersistence("test",jdbcUrl,jdbcUser,jdbcPass,dialect);
+ persistence.initialise();
persistence.initDatabase();
vpersistence = new LDCachingKiWiPersistence(persistence);
@@ -170,7 +171,7 @@ public class LDCachePersistenceTest {
LDCachingKiWiPersistenceConnection connection = vpersistence.getConnection();
try {
Assert.assertThat(connection.getDatabaseTables(), hasItems("ldcache_entries"));
- Assert.assertEquals(1, connection.getDatabaseVersion());
+ Assert.assertEquals(2, connection.getDatabaseVersion());
connection.commit();
} finally {
@@ -193,6 +194,7 @@ public class LDCachePersistenceTest {
entry1.setLastRetrieved(new Date());
entry1.setUpdateCount(1);
entry1.setResource(subject1);
+ entry1.setTripleCount(1);
connection.storeCacheEntry(entry1);
connection.commit();
@@ -205,6 +207,7 @@ public class LDCachePersistenceTest {
entry2.setLastRetrieved(new Date());
entry2.setUpdateCount(1);
entry2.setResource(subject2);
+ entry2.setTripleCount(1);
connection.storeCacheEntry(entry2);
connection.commit();
@@ -252,6 +255,7 @@ public class LDCachePersistenceTest {
entry1.setLastRetrieved(new Date());
entry1.setUpdateCount(1);
entry1.setResource(subject1);
+ entry1.setTripleCount(1);
connection.storeCacheEntry(entry1);
KiWiCacheEntry entry2 = new KiWiCacheEntry();
@@ -259,6 +263,7 @@ public class LDCachePersistenceTest {
entry2.setLastRetrieved(new Date());
entry2.setUpdateCount(1);
entry2.setResource(subject2);
+ entry2.setTripleCount(1);
connection.storeCacheEntry(entry2);
connection.commit();
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-backend-mapdb/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-mapdb/pom.xml b/libraries/ldcache/ldcache-backend-mapdb/pom.xml
index ea83c15..2b66c90 100644
--- a/libraries/ldcache/ldcache-backend-mapdb/pom.xml
+++ b/libraries/ldcache/ldcache-backend-mapdb/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.0.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating-SNAPSHOT</version>
<relativePath>../../../parent</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-core/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/pom.xml b/libraries/ldcache/ldcache-core/pom.xml
index 801f422..6b2c713 100644
--- a/libraries/ldcache/ldcache-core/pom.xml
+++ b/libraries/ldcache/ldcache-core/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
@@ -29,6 +29,27 @@
<name>LDCache: Core Library</name>
<build>
+ <pluginManagement>
+ <plugins>
+ <plugin> <!-- generate JRebel Configuration -->
+ <groupId>org.zeroturnaround</groupId>
+ <artifactId>jrebel-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-rebel-xml</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <relativePath>../../../</relativePath>
+ <rootPath>$${rebel.root}</rootPath>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -77,8 +98,8 @@
<artifactId>marmotta-commons</artifactId>
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
</dependency>
<!-- LDClient -->
@@ -152,7 +173,7 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.jumpmind.symmetric.jdbc</groupId>
+ <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java b/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java
index 89ee13b..d28a571 100644
--- a/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java
+++ b/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java
@@ -18,6 +18,7 @@
package org.apache.marmotta.ldcache.services;
import info.aduna.iteration.CloseableIteration;
+import org.apache.marmotta.commons.locking.ObjectLocks;
import org.apache.marmotta.ldcache.api.LDCachingBackend;
import org.apache.marmotta.ldcache.api.LDCachingConnection;
import org.apache.marmotta.ldcache.api.LDCachingService;
@@ -27,7 +28,6 @@ import org.apache.marmotta.ldclient.api.ldclient.LDClientService;
import org.apache.marmotta.ldclient.exception.DataRetrievalException;
import org.apache.marmotta.ldclient.model.ClientResponse;
import org.apache.marmotta.ldclient.services.ldclient.LDClient;
-import org.openrdf.model.Resource;
import org.openrdf.model.Statement;
import org.openrdf.model.URI;
import org.openrdf.repository.RepositoryConnection;
@@ -37,8 +37,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
-import java.util.HashMap;
-import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
@@ -54,7 +52,7 @@ public class LDCache implements LDCachingService {
// lock a resource while refreshing it so that not several threads trigger a refresh at the same time
- private HashMap<Resource,ReentrantLock> resourceLocks;
+ private ObjectLocks resourceLocks;
private LDClientService ldclient;
@@ -73,7 +71,7 @@ public class LDCache implements LDCachingService {
public LDCache(CacheConfiguration config, LDCachingBackend backend) {
log.info("Linked Data Caching Service initialising ...");
- this.resourceLocks = new HashMap<Resource, ReentrantLock>();
+ this.resourceLocks = new ObjectLocks();
this.backend = backend;
this.ldclient = new LDClient(config.getClientConfiguration());
this.config = config;
@@ -127,6 +125,31 @@ public class LDCache implements LDCachingService {
return backend.listExpiredEntries();
}
+
+ /**
+ * Return true if the resource is a cached resource.
+ *
+ * @param resourceUri
+ * @return
+ * @throws RepositoryException
+ */
+ public boolean isCached(String resourceUri) throws RepositoryException {
+ // if there is no cache entry, then return false in any case
+ if(!backend.isCached(resourceUri)) {
+ return false;
+ } else {
+ // else list all cached triples - if there are none, the resource is not cached (e.g. blacklist or no LD resource)
+ RepositoryConnection con = backend.getCacheConnection(resourceUri);
+ try {
+ con.begin();
+ return con.hasStatement(con.getValueFactory().createURI(resourceUri), null, null, false);
+ } finally {
+ con.commit();
+ con.close();
+ }
+ }
+ }
+
/**
* Manually expire the caching information for the given resource. The resource will be
* re-retrieved upon the next access.
@@ -182,7 +205,7 @@ public class LDCache implements LDCachingService {
*/
@Override
public void refreshResource(URI resource, boolean forceRefresh) {
- final ReentrantLock lock = lockResource(resource);
+ resourceLocks.lock(resource.stringValue());
try {
LDCachingConnection cacheConnection = backend.getCacheConnection(resource.stringValue());
CacheEntry entry = null;
@@ -225,7 +248,7 @@ public class LDCache implements LDCachingService {
cacheConnection1.remove(subject, null, null);
-
+ int count = 0;
RepositoryResult<Statement> triples = respConnection.getStatements(null,null,null,true);
while(triples.hasNext()) {
Statement triple = triples.next();
@@ -234,6 +257,7 @@ public class LDCache implements LDCachingService {
} catch (RuntimeException ex) {
log.warn("not adding triple {}: an exception occurred ({})",triple,ex.getMessage());
}
+ count++;
}
triples.close();
respConnection.close();
@@ -247,6 +271,7 @@ public class LDCache implements LDCachingService {
} else {
newEntry.setUpdateCount(1);
}
+ newEntry.setTripleCount(count);
cacheConnection1.removeCacheEntry(resource);
cacheConnection1.addCacheEntry(resource, newEntry);
@@ -270,6 +295,7 @@ public class LDCache implements LDCachingService {
} else {
newEntry.setUpdateCount(1);
}
+ newEntry.setTripleCount(0);
LDCachingConnection cacheConnection2 = backend.getCacheConnection(resource.stringValue());
cacheConnection2.begin();
@@ -293,7 +319,7 @@ public class LDCache implements LDCachingService {
} catch (RepositoryException e) {
log.error("repository exception while obtaining cache connection",e);
} finally {
- unlockResource(resource, lock);
+ resourceLocks.unlock(resource.stringValue());
}
}
@@ -390,38 +416,4 @@ public class LDCache implements LDCachingService {
public LDClientService getLDClient() {
return ldclient;
}
-
- private ReentrantLock lockResource(final URI resource) {
- ReentrantLock lock;
- synchronized (resourceLocks) {
- lock = resourceLocks.get(resource);
- if(lock == null) {
- lock = new ReentrantLock();
- resourceLocks.put(resource,lock);
- }
- }
- lock.lock();
- return lock;
- }
-
- private void unlockResource(final URI resource, final ReentrantLock lock) {
- synchronized (resourceLocks) {
- // lock = resourceLocks.get(resource);
- if (lock != null) {
- if (!lock.hasQueuedThreads()) {
- resourceLocks.remove(resource);
- }
- }
- }
- if (lock != null) {
- try {
- lock.unlock();
- } catch (IllegalMonitorStateException e) {
- log.error("Could not release lock for {} (Thread: {}, Lock: {})", resource, Thread.currentThread().getName(), lock.toString() );
- throw e;
- }
-
- }
- }
-
}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiTest.java b/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiTest.java
index be5d789..b22b600 100644
--- a/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiTest.java
+++ b/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiTest.java
@@ -274,6 +274,11 @@ public class LDCacheKiWiTest {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
+ } else {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyProvider.java b/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyProvider.java
index ca1b451..4b6f92a 100644
--- a/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyProvider.java
+++ b/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyProvider.java
@@ -69,7 +69,7 @@ public class DummyProvider implements DataProvider {
con.close();
}
- ClientResponse response = new ClientResponse(triples);
+ ClientResponse response = new ClientResponse(200, triples);
return response;
} catch (RepositoryException e) {
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-sail-generic/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-generic/pom.xml b/libraries/ldcache/ldcache-sail-generic/pom.xml
index 6e72dbd..8ed617e 100644
--- a/libraries/ldcache/ldcache-sail-generic/pom.xml
+++ b/libraries/ldcache/ldcache-sail-generic/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
@@ -33,6 +33,30 @@
on demand when needed. Can be wrapped around other Sesame SAILs.
</description>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin> <!-- generate JRebel Configuration -->
+ <groupId>org.zeroturnaround</groupId>
+ <artifactId>jrebel-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-rebel-xml</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <relativePath>../../../</relativePath>
+ <rootPath>$${rebel.root}</rootPath>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
<dependencies>
<dependency>
<groupId>org.openrdf.sesame</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-sail-generic/src/test/java/org/apache/marmotta/ldcache/sail/test/dummy/DummyProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-generic/src/test/java/org/apache/marmotta/ldcache/sail/test/dummy/DummyProvider.java b/libraries/ldcache/ldcache-sail-generic/src/test/java/org/apache/marmotta/ldcache/sail/test/dummy/DummyProvider.java
index cd58e55..15f3d81 100644
--- a/libraries/ldcache/ldcache-sail-generic/src/test/java/org/apache/marmotta/ldcache/sail/test/dummy/DummyProvider.java
+++ b/libraries/ldcache/ldcache-sail-generic/src/test/java/org/apache/marmotta/ldcache/sail/test/dummy/DummyProvider.java
@@ -69,7 +69,7 @@ public class DummyProvider implements DataProvider {
con.close();
}
- ClientResponse response = new ClientResponse(triples);
+ ClientResponse response = new ClientResponse(200, triples);
return response;
} catch (RepositoryException e) {
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-sail-kiwi/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-kiwi/pom.xml b/libraries/ldcache/ldcache-sail-kiwi/pom.xml
index 6a875af..8c755ea 100644
--- a/libraries/ldcache/ldcache-sail-kiwi/pom.xml
+++ b/libraries/ldcache/ldcache-sail-kiwi/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
@@ -35,6 +35,27 @@
<build>
+ <pluginManagement>
+ <plugins>
+ <plugin> <!-- generate JRebel Configuration -->
+ <groupId>org.zeroturnaround</groupId>
+ <artifactId>jrebel-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-rebel-xml</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <relativePath>../../../</relativePath>
+ <rootPath>$${rebel.root}</rootPath>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -99,8 +120,8 @@
<artifactId>sesame-filter</artifactId>
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
</dependency>
<!-- LDClient -->
@@ -173,7 +194,7 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.jumpmind.symmetric.jdbc</groupId>
+ <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-sail-kiwi/src/test/java/org/apache/marmotta/ldcache/sail/test/KiWiLinkedDataSailOfflineTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-kiwi/src/test/java/org/apache/marmotta/ldcache/sail/test/KiWiLinkedDataSailOfflineTest.java b/libraries/ldcache/ldcache-sail-kiwi/src/test/java/org/apache/marmotta/ldcache/sail/test/KiWiLinkedDataSailOfflineTest.java
index 20501b4..8b2de31 100644
--- a/libraries/ldcache/ldcache-sail-kiwi/src/test/java/org/apache/marmotta/ldcache/sail/test/KiWiLinkedDataSailOfflineTest.java
+++ b/libraries/ldcache/ldcache-sail-kiwi/src/test/java/org/apache/marmotta/ldcache/sail/test/KiWiLinkedDataSailOfflineTest.java
@@ -47,6 +47,7 @@ import java.util.ArrayList;
import java.util.List;
import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.Matchers.hasToString;
@@ -182,9 +183,9 @@ public class KiWiLinkedDataSailOfflineTest {
List<Statement> list1 = asList(con.getStatements(con.getValueFactory().createURI(uri1), null, null, true));
Assert.assertEquals(3,list1.size());
- Assert.assertThat(list1, allOf(
- CoreMatchers.<Statement>hasItem(hasProperty("object", hasToString("\"Value 1\"^^xsd:string"))),
- CoreMatchers.<Statement>hasItem(hasProperty("object", hasToString("\"Value X\"^^xsd:string")))
+ Assert.assertThat(list1, CoreMatchers.<Statement>hasItems(
+ hasProperty("object", hasToString("\"Value 1\"^^xsd:string")),
+ hasProperty("object", hasToString("\"Value X\"^^xsd:string"))
));
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-sail-kiwi/src/test/java/org/apache/marmotta/ldcache/sail/test/dummy/DummyProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-kiwi/src/test/java/org/apache/marmotta/ldcache/sail/test/dummy/DummyProvider.java b/libraries/ldcache/ldcache-sail-kiwi/src/test/java/org/apache/marmotta/ldcache/sail/test/dummy/DummyProvider.java
index cd58e55..15f3d81 100644
--- a/libraries/ldcache/ldcache-sail-kiwi/src/test/java/org/apache/marmotta/ldcache/sail/test/dummy/DummyProvider.java
+++ b/libraries/ldcache/ldcache-sail-kiwi/src/test/java/org/apache/marmotta/ldcache/sail/test/dummy/DummyProvider.java
@@ -69,7 +69,7 @@ public class DummyProvider implements DataProvider {
con.close();
}
- ClientResponse response = new ClientResponse(triples);
+ ClientResponse response = new ClientResponse(200, triples);
return response;
} catch (RepositoryException e) {
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource1.ttl
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource1.ttl b/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource1.ttl
index 1e6b487..6d9e0cd 100644
--- a/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource1.ttl
+++ b/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource1.ttl
@@ -16,6 +16,6 @@
# limitations under the License.
#
@prefix ex: <http://remote/> .
-ex:resource1 ex:property1 "Value 1" ;
+ex:resource1 ex:property1 "Value 1"^^xsd:string ;
ex:property2 ex:resource2 ;
- ex:property3 "Value X" .
\ No newline at end of file
+ ex:property3 "Value X"^^xsd:string .
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource2.ttl
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource2.ttl b/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource2.ttl
index 56e2544..b91edff 100644
--- a/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource2.ttl
+++ b/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource2.ttl
@@ -16,5 +16,5 @@
# limitations under the License.
#
@prefix ex: <http://remote/> .
-ex:resource2 ex:property1 "Value 2" ;
+ex:resource2 ex:property1 "Value 2"^^xsd:string ;
ex:property2 ex:resource3 .
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource3.ttl
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource3.ttl b/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource3.ttl
index 7d16a7d..2e4ab86 100644
--- a/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource3.ttl
+++ b/libraries/ldcache/ldcache-sail-kiwi/src/test/resources/org/apache/marmotta/ldcache/sail/test/dummy/resource3.ttl
@@ -16,5 +16,5 @@
# limitations under the License.
#
@prefix ex: <http://remote/> .
-ex:resource3 ex:property1 "Value 3" ;
- ex:property3 "Value 4" .
\ No newline at end of file
+ex:resource3 ex:property1 "Value 3"^^xsd:string ;
+ ex:property3 "Value 4"^^xsd:string .
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldcache/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldcache/pom.xml b/libraries/ldcache/pom.xml
index b7d126d..26dee79 100644
--- a/libraries/ldcache/pom.xml
+++ b/libraries/ldcache/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../parent</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-api/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-api/pom.xml b/libraries/ldclient/ldclient-api/pom.xml
index fc5786f..6873d92 100644
--- a/libraries/ldclient/ldclient-api/pom.xml
+++ b/libraries/ldclient/ldclient-api/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
@@ -59,8 +59,8 @@
<artifactId>sesame-sail-memory</artifactId>
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-api/src/main/java/org/apache/marmotta/ldclient/api/endpoint/Endpoint.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-api/src/main/java/org/apache/marmotta/ldclient/api/endpoint/Endpoint.java b/libraries/ldclient/ldclient-api/src/main/java/org/apache/marmotta/ldclient/api/endpoint/Endpoint.java
index d4b77a3..16759d8 100644
--- a/libraries/ldclient/ldclient-api/src/main/java/org/apache/marmotta/ldclient/api/endpoint/Endpoint.java
+++ b/libraries/ldclient/ldclient-api/src/main/java/org/apache/marmotta/ldclient/api/endpoint/Endpoint.java
@@ -139,17 +139,18 @@ public class Endpoint implements Comparable<Endpoint> {
private Map<String,String> properties;
public Endpoint() {
+ this.active = true;
+ this.contentTypes = new HashSet<ContentType>();
+ this.properties = new HashMap<String, String>();
}
public Endpoint(String name, String type, String uriPattern, String endpointUrl, Long defaultExpiry) {
+ this();
this.name = name;
this.type = type;
this.uriPattern = uriPattern;
this.endpointUrl = endpointUrl;
- this.contentTypes = new HashSet<ContentType>();
this.defaultExpiry = defaultExpiry;
- this.active = true;
- this.properties = new HashMap<String, String>();
}
public Endpoint(String name, String type, String uriPattern, String endpointUrl, String contentType, Long defaultExpiry) {
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-api/src/main/java/org/apache/marmotta/ldclient/model/ClientResponse.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-api/src/main/java/org/apache/marmotta/ldclient/model/ClientResponse.java b/libraries/ldclient/ldclient-api/src/main/java/org/apache/marmotta/ldclient/model/ClientResponse.java
index bf3c29f..70ebf48 100644
--- a/libraries/ldclient/ldclient-api/src/main/java/org/apache/marmotta/ldclient/model/ClientResponse.java
+++ b/libraries/ldclient/ldclient-api/src/main/java/org/apache/marmotta/ldclient/model/ClientResponse.java
@@ -17,7 +17,7 @@
*/
package org.apache.marmotta.ldclient.model;
-import org.apache.commons.lang.time.DateUtils;
+import org.apache.commons.lang3.time.DateUtils;
import org.openrdf.repository.Repository;
import java.util.Date;
@@ -30,15 +30,27 @@ import java.util.Date;
*/
public class ClientResponse {
+ private static final int DEFAULT_HTTP_CODE = 200;
+
private static final int DEFAULT_EXPIRATION_IN_DAYS = 7;
+ /**
+ * The HTTP status code returned by the client
+ */
+ private int httpStatus;
+
private Repository triples;
private Date expires;
-
+
public ClientResponse(Repository triples) {
+ this(DEFAULT_HTTP_CODE, triples);
+ }
+
+ public ClientResponse(int httpStatus, Repository triples) {
this.triples = triples;
this.expires = DateUtils.addDays(new Date(), DEFAULT_EXPIRATION_IN_DAYS);
+ this.httpStatus = httpStatus;
}
public Repository getTriples() {
@@ -57,4 +69,11 @@ public class ClientResponse {
this.expires = new Date(expires.getTime());
}
+ public int getHttpStatus() {
+ return httpStatus;
+ }
+
+ public void setHttpStatus(int httpStatus) {
+ this.httpStatus = httpStatus;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-core/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-core/pom.xml b/libraries/ldclient/ldclient-core/pom.xml
index 6e80e58..de02401 100644
--- a/libraries/ldclient/ldclient-core/pom.xml
+++ b/libraries/ldclient/ldclient-core/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
@@ -73,8 +73,8 @@
<artifactId>marmotta-commons</artifactId>
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
</dependency>
<!-- logging -->
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/ldclient/LDClient.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/ldclient/LDClient.java b/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/ldclient/LDClient.java
index 7fe6a9c..13f2421 100644
--- a/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/ldclient/LDClient.java
+++ b/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/ldclient/LDClient.java
@@ -17,7 +17,6 @@
*/
package org.apache.marmotta.ldclient.services.ldclient;
-import org.apache.commons.lang.NotImplementedException;
import org.apache.http.Header;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
@@ -161,7 +160,7 @@ public final class LDClient implements LDClientService {
return false;
}
} else {
- throw new NotImplementedException("protocol not supportted");
+ throw new UnsupportedOperationException("protocol not supportted");
}
/*
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/AbstractHttpProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/AbstractHttpProvider.java b/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/AbstractHttpProvider.java
index 175baa5..ef89751 100644
--- a/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/AbstractHttpProvider.java
+++ b/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/AbstractHttpProvider.java
@@ -60,6 +60,7 @@ import static org.apache.marmotta.commons.http.LMFHttpUtils.parseContentType;
*/
public abstract class AbstractHttpProvider implements DataProvider {
+ public static final int RETRY_AFTER = 60;
private static Logger log = LoggerFactory.getLogger(AbstractHttpProvider.class);
/**
@@ -175,7 +176,7 @@ public abstract class AbstractHttpProvider implements DataProvider {
con.close();
}
- ClientResponse result = new ClientResponse(handler.triples);
+ ClientResponse result = new ClientResponse(handler.httpStatus, handler.triples);
result.setExpires(expiresDate);
return result;
} catch (RepositoryException e) {
@@ -228,6 +229,8 @@ public abstract class AbstractHttpProvider implements DataProvider {
private final String resource;
+ private int httpStatus;
+
public ResponseHandler(String resource, Endpoint endpoint) throws RepositoryException {
this.resource = resource;
this.endpoint = endpoint;
@@ -244,13 +247,15 @@ public abstract class AbstractHttpProvider implements DataProvider {
final HttpEntity entity = response.getEntity();
if (entity == null)
throw new IOException("no content returned by Linked Data resource " + resource);
-
+
if (!isValidContentType(entity.getContentType().getValue().split(";")[0], endpoint)) {
// FIXME: here was get.abort()
throw new IOException("invalid content returned by Linked Data resource " + resource + ": "
+ entity.getContentType().getValue());
}
+ this.httpStatus = response.getStatusLine().getStatusCode();
+
if (entity != null) {
String parseContentType = "application/rdf+xml";
if (endpoint != null && "SPARQL".equals(endpoint.getType())) {
@@ -282,8 +287,23 @@ public abstract class AbstractHttpProvider implements DataProvider {
} finally {
in.close();
}
- }
+ }
EntityUtils.consume(entity);
+ } else if(response.getStatusLine().getStatusCode() == 500 || response.getStatusLine().getStatusCode() == 503 || response.getStatusLine().getStatusCode() == 504) {
+ this.httpStatus = response.getStatusLine().getStatusCode();
+
+ Header retry = response.getFirstHeader("Retry-After");
+ if(retry != null) {
+ try {
+ int duration = Integer.parseInt(retry.getValue());
+ expiresDate = new Date(System.currentTimeMillis() + duration*1000);
+ } catch(NumberFormatException ex) {
+ log.debug("error parsing Retry-After: header");
+ }
+ } else {
+ expiresDate = new Date(System.currentTimeMillis() + RETRY_AFTER *1000);
+ }
+
} else {
log.error("the HTTP request failed (status: {})", response.getStatusLine());
throw new ClientProtocolException("the HTTP request failed (status: " + response.getStatusLine() + ")");
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/BlockingProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/BlockingProvider.java b/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/BlockingProvider.java
index feec3f4..ae75d59 100644
--- a/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/BlockingProvider.java
+++ b/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/BlockingProvider.java
@@ -87,7 +87,7 @@ public class BlockingProvider implements DataProvider {
long defaultExpires = client.getClientConfiguration().getDefaultExpiry();
Date expiresDate = new Date(System.currentTimeMillis() + defaultExpires * 1000);
- ClientResponse result = new ClientResponse(empty_repository);
+ ClientResponse result = new ClientResponse(200, empty_repository);
result.setExpires(expiresDate);
return result;
}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-core/src/test/java/org/apache/marmotta/ldclient/test/TestLDClientTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-core/src/test/java/org/apache/marmotta/ldclient/test/TestLDClientTest.java b/libraries/ldclient/ldclient-core/src/test/java/org/apache/marmotta/ldclient/test/TestLDClientTest.java
index 2cf0a4f..4570c08 100644
--- a/libraries/ldclient/ldclient-core/src/test/java/org/apache/marmotta/ldclient/test/TestLDClientTest.java
+++ b/libraries/ldclient/ldclient-core/src/test/java/org/apache/marmotta/ldclient/test/TestLDClientTest.java
@@ -30,6 +30,8 @@ import org.junit.runner.Description;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.net.URI;
+
public class TestLDClientTest {
private TestLDClient client;
@@ -67,7 +69,7 @@ public class TestLDClientTest {
@Test(expected = DataRetrievalException.class)
public void testLocalhostInvalidPort() throws Exception {
- client.retrieveResource("http://127.1.2.3:-1/");
+ client.retrieveResource("http://127.1.2.3:66000/");
Assert.fail();
}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-facebook/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-facebook/pom.xml b/libraries/ldclient/ldclient-provider-facebook/pom.xml
index 7b044f3..e1526d5 100644
--- a/libraries/ldclient/ldclient-provider-facebook/pom.xml
+++ b/libraries/ldclient/ldclient-provider-facebook/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-facebook/src/main/java/org/apache/marmotta/ldclient/provider/facebook/FacebookGraphProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-facebook/src/main/java/org/apache/marmotta/ldclient/provider/facebook/FacebookGraphProvider.java b/libraries/ldclient/ldclient-provider-facebook/src/main/java/org/apache/marmotta/ldclient/provider/facebook/FacebookGraphProvider.java
index c7fb128..e9d606a 100644
--- a/libraries/ldclient/ldclient-provider-facebook/src/main/java/org/apache/marmotta/ldclient/provider/facebook/FacebookGraphProvider.java
+++ b/libraries/ldclient/ldclient-provider-facebook/src/main/java/org/apache/marmotta/ldclient/provider/facebook/FacebookGraphProvider.java
@@ -22,12 +22,9 @@ import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.utils.URIUtils;
import org.apache.http.impl.cookie.DateParseException;
import org.apache.http.impl.cookie.DateUtils;
import org.apache.http.util.EntityUtils;
-import org.apache.marmotta.commons.collections.CollectionUtils;
-import org.apache.marmotta.commons.http.ContentType;
import org.apache.marmotta.commons.http.UriUtil;
import org.apache.marmotta.commons.vocabulary.DCTERMS;
import org.apache.marmotta.commons.vocabulary.FOAF;
@@ -37,7 +34,6 @@ import org.apache.marmotta.ldclient.api.ldclient.LDClientService;
import org.apache.marmotta.ldclient.api.provider.DataProvider;
import org.apache.marmotta.ldclient.exception.DataRetrievalException;
import org.apache.marmotta.ldclient.model.ClientResponse;
-import org.apache.marmotta.ldclient.services.provider.AbstractHttpProvider;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
@@ -60,8 +56,6 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import static org.apache.marmotta.commons.http.LMFHttpUtils.parseContentType;
-
/**
* A provider that accesses objects exposed by the Facebook Graph API (in JSON format). The provider will map the
* properties of Facebook Objects to RDF and tries choosing the most appropriate RDF types and vocabularies. The base
@@ -76,6 +70,7 @@ public class FacebookGraphProvider implements DataProvider {
private static final Pattern pattern = Pattern.compile("http://www\\.facebook\\.com/([^/]+/)*([^/]+)");
+ public static final int RETRY_AFTER = 60;
private static Logger log = LoggerFactory.getLogger(FacebookGraphProvider.class);
@@ -406,7 +401,7 @@ public class FacebookGraphProvider implements DataProvider {
con.close();
}
- ClientResponse result = new ClientResponse(handler.triples);
+ ClientResponse result = new ClientResponse(200, handler.triples);
result.setExpires(expiresDate);
return result;
} catch (RepositoryException e) {
@@ -439,6 +434,8 @@ public class FacebookGraphProvider implements DataProvider {
private final String resource;
+ private int httpStatus;
+
// language tag to use for literals
public String language;
@@ -459,6 +456,7 @@ public class FacebookGraphProvider implements DataProvider {
if (entity == null)
throw new IOException("no content returned by Linked Data resource " + resource);
+ this.httpStatus = response.getStatusLine().getStatusCode();
if (entity != null) {
InputStream in = entity.getContent();
@@ -486,6 +484,21 @@ public class FacebookGraphProvider implements DataProvider {
}
}
EntityUtils.consume(entity);
+ } else if(response.getStatusLine().getStatusCode() == 500 || response.getStatusLine().getStatusCode() == 503 || response.getStatusLine().getStatusCode() == 504) {
+ this.httpStatus = response.getStatusLine().getStatusCode();
+
+ Header retry = response.getFirstHeader("Retry-After");
+ if(retry != null) {
+ try {
+ int duration = Integer.parseInt(retry.getValue());
+ expiresDate = new Date(System.currentTimeMillis() + duration*1000);
+ } catch(NumberFormatException ex) {
+ log.debug("error parsing Retry-After: header");
+ }
+ } else {
+ expiresDate = new Date(System.currentTimeMillis() + RETRY_AFTER *1000);
+ }
+
} else {
log.error("the HTTP request failed (status: {})", response.getStatusLine());
throw new ClientProtocolException("the HTTP request failed (status: " + response.getStatusLine() + ")");
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-html/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-html/pom.xml b/libraries/ldclient/ldclient-provider-html/pom.xml
index efa9821..8b4a77d 100644
--- a/libraries/ldclient/ldclient-provider-html/pom.xml
+++ b/libraries/ldclient/ldclient-provider-html/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssDateLiteralMapper.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssDateLiteralMapper.java b/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssDateLiteralMapper.java
index bbc2b3b..001fb80 100644
--- a/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssDateLiteralMapper.java
+++ b/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssDateLiteralMapper.java
@@ -62,7 +62,7 @@ public class CssDateLiteralMapper extends CssTextLiteralMapper {
@Override
public List<Value> map(String resourceUri, Element elem, ValueFactory factory) {
- final String value = elem.text().trim();
+ final String value = cleanValue(elem.text());
Date date = parseDate(value);
final String dateString;
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssLiteralAttrMapper.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssLiteralAttrMapper.java b/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssLiteralAttrMapper.java
index 29ded1d..5cf91af 100644
--- a/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssLiteralAttrMapper.java
+++ b/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssLiteralAttrMapper.java
@@ -18,7 +18,7 @@
package org.apache.marmotta.ldclient.provider.html.mapping;
import org.apache.marmotta.commons.sesame.model.Namespaces;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.jsoup.nodes.Element;
import org.openrdf.model.Value;
import org.openrdf.model.ValueFactory;
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssTextLiteralMapper.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssTextLiteralMapper.java b/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssTextLiteralMapper.java
index 886307c..e3e9ac4 100644
--- a/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssTextLiteralMapper.java
+++ b/libraries/ldclient/ldclient-provider-html/src/main/java/org/apache/marmotta/ldclient/provider/html/mapping/CssTextLiteralMapper.java
@@ -17,7 +17,7 @@
*/
package org.apache.marmotta.ldclient.provider.html.mapping;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.marmotta.commons.sesame.model.Namespaces;
import org.jsoup.nodes.Element;
import org.openrdf.model.Value;
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-ldap/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-ldap/pom.xml b/libraries/ldclient/ldclient-provider-ldap/pom.xml
index 4736c8f..539209e 100644
--- a/libraries/ldclient/ldclient-provider-ldap/pom.xml
+++ b/libraries/ldclient/ldclient-provider-ldap/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-ldap/src/main/java/org/apache/marmotta/ldclient/provider/ldap/LdapFoafProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-ldap/src/main/java/org/apache/marmotta/ldclient/provider/ldap/LdapFoafProvider.java b/libraries/ldclient/ldclient-provider-ldap/src/main/java/org/apache/marmotta/ldclient/provider/ldap/LdapFoafProvider.java
index e0ade1b..3873391 100644
--- a/libraries/ldclient/ldclient-provider-ldap/src/main/java/org/apache/marmotta/ldclient/provider/ldap/LdapFoafProvider.java
+++ b/libraries/ldclient/ldclient-provider-ldap/src/main/java/org/apache/marmotta/ldclient/provider/ldap/LdapFoafProvider.java
@@ -184,7 +184,7 @@ public class LdapFoafProvider implements DataProvider {
}
- final ClientResponse resp = new ClientResponse(rep);
+ final ClientResponse resp = new ClientResponse(200, rep);
resp.setExpires(new Date());
return resp;
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-mediawiki/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-mediawiki/pom.xml b/libraries/ldclient/ldclient-provider-mediawiki/pom.xml
index a97c354..c2d2d9f 100644
--- a/libraries/ldclient/ldclient-provider-mediawiki/pom.xml
+++ b/libraries/ldclient/ldclient-provider-mediawiki/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-mediawiki/src/main/java/org/apache/marmotta/ldclient/provider/mediawiki/MediawikiProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-mediawiki/src/main/java/org/apache/marmotta/ldclient/provider/mediawiki/MediawikiProvider.java b/libraries/ldclient/ldclient-provider-mediawiki/src/main/java/org/apache/marmotta/ldclient/provider/mediawiki/MediawikiProvider.java
index d9e4a06..7c23d37 100644
--- a/libraries/ldclient/ldclient-provider-mediawiki/src/main/java/org/apache/marmotta/ldclient/provider/mediawiki/MediawikiProvider.java
+++ b/libraries/ldclient/ldclient-provider-mediawiki/src/main/java/org/apache/marmotta/ldclient/provider/mediawiki/MediawikiProvider.java
@@ -72,7 +72,7 @@ public class MediawikiProvider extends AbstractHttpProvider {
private static Logger log = LoggerFactory.getLogger(MediawikiProvider.class);
private static final Pattern COLON_PREFIX_PATTERN = Pattern.compile("^[^:]*:");
- private static final Pattern REDIRECT_PATTERN = Pattern.compile("^#REDIRECT\\s+\\[\\[([^#\\]]*)(#.*)?\\]\\]",
+ private static final Pattern REDIRECT_PATTERN = Pattern.compile("^#REDIRECT\\s*\\[\\[([^#\\]]*)(#.*)?\\]\\]",
Pattern.CASE_INSENSITIVE);
private static final int MAX_TITLES_PER_QUERY = 50;
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-phpbb/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-phpbb/pom.xml b/libraries/ldclient/ldclient-provider-phpbb/pom.xml
index c67862f..6719feb 100644
--- a/libraries/ldclient/ldclient-provider-phpbb/pom.xml
+++ b/libraries/ldclient/ldclient-provider-phpbb/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-rdf/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-rdf/pom.xml b/libraries/ldclient/ldclient-provider-rdf/pom.xml
index 3f81d0b..fd75822 100644
--- a/libraries/ldclient/ldclient-provider-rdf/pom.xml
+++ b/libraries/ldclient/ldclient-provider-rdf/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
@@ -45,6 +45,10 @@
<dependency>
<groupId>org.openrdf.sesame</groupId>
+ <artifactId>sesame-rio-rdfjson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-rio-rdfxml</artifactId>
</dependency>
<dependency>
@@ -56,12 +60,8 @@
<artifactId>sesame-rio-n3</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.marmotta</groupId>
- <artifactId>sesame-tools-rio-jsonld</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.marmotta</groupId>
- <artifactId>sesame-tools-rio-rdfjson</artifactId>
+ <groupId>com.github.jsonld-java</groupId>
+ <artifactId>jsonld-java-sesame</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-rdf/src/main/java/org/apache/marmotta/ldclient/provider/rdf/SPARQLProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-rdf/src/main/java/org/apache/marmotta/ldclient/provider/rdf/SPARQLProvider.java b/libraries/ldclient/ldclient-provider-rdf/src/main/java/org/apache/marmotta/ldclient/provider/rdf/SPARQLProvider.java
index 929b59e..cc39f14 100644
--- a/libraries/ldclient/ldclient-provider-rdf/src/main/java/org/apache/marmotta/ldclient/provider/rdf/SPARQLProvider.java
+++ b/libraries/ldclient/ldclient-provider-rdf/src/main/java/org/apache/marmotta/ldclient/provider/rdf/SPARQLProvider.java
@@ -24,6 +24,7 @@ import org.apache.marmotta.ldclient.services.provider.AbstractHttpProvider;
import org.openrdf.model.URI;
import org.openrdf.model.Value;
import org.openrdf.query.BindingSet;
+import org.openrdf.query.QueryResultHandlerException;
import org.openrdf.query.TupleQueryResultHandler;
import org.openrdf.query.TupleQueryResultHandlerException;
import org.openrdf.query.resultio.QueryResultIO;
@@ -151,9 +152,14 @@ public class SPARQLProvider extends AbstractHttpProvider {
public void endQueryResult() throws TupleQueryResultHandlerException {
try {
con.commit();
- con.close();
} catch (RepositoryException e) {
- throw new TupleQueryResultHandlerException("error while closing repository connection",e);
+ throw new TupleQueryResultHandlerException("error while committing repository connection",e);
+ } finally {
+ try {
+ con.close();
+ } catch(RepositoryException e) {
+ throw new TupleQueryResultHandlerException("error while closing repository connection",e);
+ }
}
}
@@ -173,6 +179,19 @@ public class SPARQLProvider extends AbstractHttpProvider {
throw new TupleQueryResultHandlerException("error while adding triple to repository connection",e);
}
}
+
+ @Override
+ public void handleBoolean(boolean bool ) throws QueryResultHandlerException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void handleLinks(List<String> links) throws QueryResultHandlerException {
+ // TODO Auto-generated method stub
+
+ }
+
},
triples.getValueFactory());
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-rdf/src/test/java/org/apache/marmotta/ldclient/test/rdf/TestStanbolProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-rdf/src/test/java/org/apache/marmotta/ldclient/test/rdf/TestStanbolProvider.java b/libraries/ldclient/ldclient-provider-rdf/src/test/java/org/apache/marmotta/ldclient/test/rdf/TestStanbolProvider.java
index 11a83a4..9df1cd7 100644
--- a/libraries/ldclient/ldclient-provider-rdf/src/test/java/org/apache/marmotta/ldclient/test/rdf/TestStanbolProvider.java
+++ b/libraries/ldclient/ldclient-provider-rdf/src/test/java/org/apache/marmotta/ldclient/test/rdf/TestStanbolProvider.java
@@ -25,6 +25,7 @@ import org.apache.marmotta.ldclient.model.ClientResponse;
import org.apache.marmotta.ldclient.services.ldclient.LDClient;
import org.apache.marmotta.ldclient.test.helper.TestLDClient;
import org.junit.Assert;
+import org.junit.Assume;
import org.junit.Test;
import org.openrdf.query.BooleanQuery;
import org.openrdf.query.QueryLanguage;
@@ -53,6 +54,8 @@ public class TestStanbolProvider {
LDClientService ldclient = new TestLDClient(new LDClient(config));
+ Assume.assumeTrue(ldclient.ping("http://dev.iks-project.eu:8080/"));
+
String uriBerlin = "http://dbpedia.org/resource/Berlin";
ClientResponse respBerlin = ldclient.retrieveResource(uriBerlin);
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-rdfa/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-rdfa/pom.xml b/libraries/ldclient/ldclient-provider-rdfa/pom.xml
index eb1e264..8dcd4b3 100644
--- a/libraries/ldclient/ldclient-provider-rdfa/pom.xml
+++ b/libraries/ldclient/ldclient-provider-rdfa/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-vimeo/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-vimeo/pom.xml b/libraries/ldclient/ldclient-provider-vimeo/pom.xml
index 541bd79..d1e38fa 100644
--- a/libraries/ldclient/ldclient-provider-vimeo/pom.xml
+++ b/libraries/ldclient/ldclient-provider-vimeo/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-xml/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-xml/pom.xml b/libraries/ldclient/ldclient-provider-xml/pom.xml
index 0ff9206..12ebc32 100644
--- a/libraries/ldclient/ldclient-provider-xml/pom.xml
+++ b/libraries/ldclient/ldclient-provider-xml/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-youtube/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-youtube/pom.xml b/libraries/ldclient/ldclient-provider-youtube/pom.xml
index 062ce27..43ebc06 100644
--- a/libraries/ldclient/ldclient-provider-youtube/pom.xml
+++ b/libraries/ldclient/ldclient-provider-youtube/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../../parent</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoPagesProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoPagesProvider.java b/libraries/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoPagesProvider.java
index 65c9c13..7258510 100644
--- a/libraries/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoPagesProvider.java
+++ b/libraries/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoPagesProvider.java
@@ -17,8 +17,8 @@
*/
package org.apache.marmotta.ldclient.provider.youtube;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.time.DateUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
@@ -122,7 +122,7 @@ public class YoutubeVideoPagesProvider implements DataProvider {
log.error(msg);
throw new RuntimeException(msg, e);
}
- ClientResponse clientResponse = new ClientResponse(triples);
+ ClientResponse clientResponse = new ClientResponse(200, triples);
clientResponse.setExpires(DateUtils.addYears(new Date(), 10));
return clientResponse;
}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/libraries/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoProvider.java b/libraries/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoProvider.java
index 086ae18..702aba3 100644
--- a/libraries/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoProvider.java
+++ b/libraries/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoProvider.java
@@ -19,7 +19,7 @@ package org.apache.marmotta.ldclient.provider.youtube;
import org.apache.marmotta.commons.sesame.model.Namespaces;
import com.google.common.collect.ImmutableList;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
import org.apache.marmotta.ldclient.api.provider.DataProvider;
import org.apache.marmotta.ldclient.provider.xml.AbstractXMLDataProvider;