-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
195 changed files
with
4,436 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...va/org/eclipse/rdf4j/sail/extensiblestore/ExtensibleStoreSPARQL11QueryComplianceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Eclipse RDF4J contributors. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
******************************************************************************/ | ||
|
||
package org.eclipse.rdf4j.sail.extensiblestore; | ||
|
||
import org.eclipse.rdf4j.repository.Repository; | ||
import org.eclipse.rdf4j.repository.dataset.DatasetRepository; | ||
import org.eclipse.rdf4j.repository.sail.SailRepository; | ||
import org.eclipse.rdf4j.sail.extensiblestore.impl.ExtensibleStoreOrderedImplForTests; | ||
import org.eclipse.rdf4j.testsuite.query.parser.sparql.manifest.SPARQL11QueryComplianceTest; | ||
|
||
public class ExtensibleStoreSPARQL11QueryComplianceTest extends SPARQL11QueryComplianceTest { | ||
|
||
@Override | ||
protected Repository newRepository() { | ||
return new DatasetRepository(new SailRepository(new ExtensibleStoreOrderedImplForTests())); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...a/org/eclipse/rdf4j/sail/extensiblestore/ExtensibleStoreSPARQL11UpdateComplianceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Eclipse RDF4J contributors. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
******************************************************************************/ | ||
|
||
package org.eclipse.rdf4j.sail.extensiblestore; | ||
|
||
import org.eclipse.rdf4j.repository.Repository; | ||
import org.eclipse.rdf4j.repository.sail.SailRepository; | ||
import org.eclipse.rdf4j.sail.extensiblestore.impl.ExtensibleStoreOrderedImplForTests; | ||
import org.eclipse.rdf4j.testsuite.query.parser.sparql.manifest.SPARQL11UpdateComplianceTest; | ||
|
||
/** | ||
* Test SPARQL 1.1 Update functionality on an in-memory store. | ||
*/ | ||
public class ExtensibleStoreSPARQL11UpdateComplianceTest extends SPARQL11UpdateComplianceTest { | ||
|
||
@Override | ||
protected Repository newRepository() { | ||
return new SailRepository(new ExtensibleStoreOrderedImplForTests()); | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
...eclipse/rdf4j/sail/extensiblestore/impl/ExtensibleStoreConnectionOrderedImplForTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Eclipse RDF4J contributors. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
******************************************************************************/ | ||
|
||
package org.eclipse.rdf4j.sail.extensiblestore.impl; | ||
|
||
import org.eclipse.rdf4j.sail.extensiblestore.ExtensibleStoreConnection; | ||
|
||
class ExtensibleStoreConnectionOrderedImplForTests | ||
extends ExtensibleStoreConnection<ExtensibleStoreOrderedImplForTests> { | ||
protected ExtensibleStoreConnectionOrderedImplForTests(ExtensibleStoreOrderedImplForTests sail) { | ||
super(sail); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
.../java/org/eclipse/rdf4j/sail/extensiblestore/impl/ExtensibleStoreOrderedImplForTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Eclipse RDF4J contributors. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
******************************************************************************/ | ||
|
||
package org.eclipse.rdf4j.sail.extensiblestore.impl; | ||
|
||
import org.eclipse.rdf4j.common.annotation.InternalUseOnly; | ||
import org.eclipse.rdf4j.query.algebra.evaluation.impl.EvaluationStatistics; | ||
import org.eclipse.rdf4j.sail.NotifyingSailConnection; | ||
import org.eclipse.rdf4j.sail.SailException; | ||
import org.eclipse.rdf4j.sail.extensiblestore.ExtensibleStore; | ||
import org.eclipse.rdf4j.sail.extensiblestore.SimpleMemoryNamespaceStore; | ||
|
||
@InternalUseOnly | ||
public class ExtensibleStoreOrderedImplForTests | ||
extends ExtensibleStore<OrderedDataStructure, SimpleMemoryNamespaceStore> { | ||
|
||
public ExtensibleStoreOrderedImplForTests() { | ||
super(Cache.NONE); | ||
} | ||
|
||
public ExtensibleStoreOrderedImplForTests(Cache cache) { | ||
super(cache); | ||
} | ||
|
||
@Override | ||
protected synchronized void initializeInternal() throws SailException { | ||
namespaceStore = new SimpleMemoryNamespaceStore(); | ||
dataStructure = new OrderedDataStructure(); | ||
super.initializeInternal(); | ||
} | ||
|
||
@Override | ||
protected NotifyingSailConnection getConnectionInternal() throws SailException { | ||
return new ExtensibleStoreConnectionOrderedImplForTests(this); | ||
} | ||
|
||
@Override | ||
public boolean isWritable() throws SailException { | ||
return true; | ||
} | ||
|
||
public EvaluationStatistics getEvalStats() { | ||
return sailStore.getEvaluationStatistics(); | ||
} | ||
} |
102 changes: 102 additions & 0 deletions
102
...parql/src/test/java/org/eclipse/rdf4j/sail/extensiblestore/impl/OrderedDataStructure.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Eclipse RDF4J contributors. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
******************************************************************************/ | ||
|
||
package org.eclipse.rdf4j.sail.extensiblestore.impl; | ||
|
||
import java.util.Collections; | ||
import java.util.Comparator; | ||
import java.util.EnumSet; | ||
import java.util.Set; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
import org.eclipse.rdf4j.common.iteration.CloseableIteration; | ||
import org.eclipse.rdf4j.common.iteration.CloseableIteratorIteration; | ||
import org.eclipse.rdf4j.common.iteration.EmptyIteration; | ||
import org.eclipse.rdf4j.common.order.StatementOrder; | ||
import org.eclipse.rdf4j.model.IRI; | ||
import org.eclipse.rdf4j.model.Resource; | ||
import org.eclipse.rdf4j.model.Value; | ||
import org.eclipse.rdf4j.sail.extensiblestore.DataStructureInterface; | ||
import org.eclipse.rdf4j.sail.extensiblestore.FilteringIteration; | ||
import org.eclipse.rdf4j.sail.extensiblestore.SortedIteration; | ||
import org.eclipse.rdf4j.sail.extensiblestore.valuefactory.ExtensibleStatement; | ||
|
||
class OrderedDataStructure implements DataStructureInterface { | ||
|
||
private static final EmptyIteration<ExtensibleStatement> EMPTY_ITERATION = new EmptyIteration<>(); | ||
|
||
Set<ExtensibleStatement> statements = Collections.newSetFromMap(new ConcurrentHashMap<>()); | ||
|
||
@Override | ||
synchronized public void addStatement(ExtensibleStatement statement) { | ||
statements.add(statement); | ||
} | ||
|
||
@Override | ||
synchronized public void removeStatement(ExtensibleStatement statement) { | ||
statements.remove(statement); | ||
|
||
} | ||
|
||
@Override | ||
synchronized public CloseableIteration<? extends ExtensibleStatement> getStatements(Resource subject, | ||
IRI predicate, | ||
Value object, boolean inferred, Resource... context) { | ||
return new FilteringIteration<>( | ||
new CloseableIteratorIteration<>(statements.iterator()), subject, predicate, object, inferred, context); | ||
} | ||
|
||
@Override | ||
public CloseableIteration<? extends ExtensibleStatement> getStatements(StatementOrder statementOrder, | ||
Resource subject, IRI predicate, Value object, boolean inferred, Resource... contexts) { | ||
if (statements.isEmpty()) { | ||
return EMPTY_ITERATION; | ||
} | ||
if (inferred) { | ||
boolean containsInferred = statements.stream().anyMatch(ExtensibleStatement::isInferred); | ||
if (!containsInferred) | ||
return EMPTY_ITERATION; | ||
} | ||
return new SortedIteration<>(new FilteringIteration<>(new CloseableIteratorIteration<>(statements.iterator()), | ||
subject, predicate, object, inferred, contexts), statementOrder); | ||
} | ||
|
||
@Override | ||
public void flushForReading() { | ||
|
||
} | ||
|
||
@Override | ||
public void init() { | ||
|
||
} | ||
|
||
@Override | ||
public void flushForCommit() { | ||
|
||
} | ||
|
||
@Override | ||
public long getEstimatedSize() { | ||
return statements.size(); | ||
} | ||
|
||
@Override | ||
public Set<StatementOrder> getSupportedOrders(Resource subj, IRI pred, Value obj, boolean inferred, | ||
Resource... contexts) { | ||
return EnumSet.of(StatementOrder.S, StatementOrder.P, StatementOrder.O, StatementOrder.C); | ||
} | ||
|
||
@Override | ||
public Comparator<Value> getComparator() { | ||
return Comparator.comparing(Value::stringValue); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.