forked from apache/jena
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JENA-1447: Merge commit 'refs/pull/328/head' of github.com:apache/jena
This closes apache#328.
- Loading branch information
Showing
15 changed files
with
868 additions
and
42 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
104 changes: 104 additions & 0 deletions
104
jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphSink.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,104 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.apache.jena.sparql.core; | ||
|
||
import java.util.Iterator; | ||
|
||
import org.apache.jena.atlas.iterator.Iter; | ||
import org.apache.jena.graph.Graph; | ||
import org.apache.jena.graph.Node; | ||
import org.apache.jena.query.ReadWrite; | ||
import org.apache.jena.sparql.graph.GraphSink; | ||
|
||
|
||
/** | ||
* An always empty {@link DatasetGraph} that accepts changes but ignores them. | ||
* | ||
* @see DatasetGraphZero | ||
*/ | ||
public class DatasetGraphSink extends DatasetGraphBaseFind { | ||
|
||
public static DatasetGraph create() { return new DatasetGraphSink(); } | ||
|
||
private Graph dftGraph = GraphSink.instance(); | ||
|
||
public DatasetGraphSink() {} | ||
|
||
private TransactionalNull txn = TransactionalNull.create(); | ||
@Override public void begin(ReadWrite mode) { txn.begin(mode); } | ||
@Override public void commit() { txn.commit(); } | ||
@Override public void abort() { txn.abort(); } | ||
@Override public boolean isInTransaction() { return txn.isInTransaction(); } | ||
@Override public void end() { txn.end(); } | ||
@Override public boolean supportsTransactions() { return true; } | ||
// Because there are never any changes, abort() means "finish". | ||
@Override public boolean supportsTransactionAbort() { return true; } | ||
|
||
@Override | ||
public Iterator<Node> listGraphNodes() { | ||
return Iter.nullIterator(); | ||
} | ||
|
||
@Override | ||
protected Iterator<Quad> findInDftGraph(Node s, Node p, Node o) { | ||
return Iter.nullIterator(); | ||
} | ||
|
||
@Override | ||
protected Iterator<Quad> findInSpecificNamedGraph(Node g, Node s, Node p, Node o) { | ||
return Iter.nullIterator(); | ||
} | ||
|
||
@Override | ||
protected Iterator<Quad> findInAnyNamedGraphs(Node s, Node p, Node o) { | ||
return Iter.nullIterator(); | ||
} | ||
|
||
@Override | ||
public Graph getDefaultGraph() { | ||
return dftGraph; | ||
} | ||
@Override | ||
public Graph getGraph(Node graphNode) { | ||
return null; | ||
} | ||
@Override | ||
public void add(Quad quad) { /* ignore */ } | ||
|
||
@Override | ||
public void delete(Quad quad) { /* ignore */ } | ||
|
||
@Override | ||
public void deleteAny(Node g, Node s, Node p, Node o) { /* ignore */ } | ||
|
||
@Override | ||
public void setDefaultGraph(Graph g) { /* ignore */ } | ||
|
||
@Override | ||
public void addGraph(Node graphName, Graph graph) { /* ignore */ } | ||
|
||
@Override | ||
public void removeGraph(Node graphName) { /* ignore */ } | ||
|
||
@Override | ||
public void close() { | ||
txn.remove(); | ||
txn = null; | ||
} | ||
} |
107 changes: 107 additions & 0 deletions
107
jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphZero.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,107 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.apache.jena.sparql.core; | ||
|
||
import java.util.Iterator; | ||
|
||
import org.apache.jena.atlas.iterator.Iter; | ||
import org.apache.jena.graph.Graph; | ||
import org.apache.jena.graph.Node; | ||
import org.apache.jena.query.ReadWrite; | ||
import org.apache.jena.sparql.graph.GraphZero; | ||
|
||
/** An always empty {@link DatasetGraph}. | ||
* One graph (the default graph) with zero triples. | ||
* No changes allowed - this is not a sink. | ||
* @see DatasetGraphSink | ||
*/ | ||
public class DatasetGraphZero extends DatasetGraphBaseFind { | ||
|
||
public static DatasetGraph create() { return new DatasetGraphZero(); } | ||
|
||
private Graph dftGraph = GraphZero.instance(); | ||
|
||
public DatasetGraphZero() {} | ||
|
||
private TransactionalNull txn = TransactionalNull.create(); | ||
@Override public void begin(ReadWrite mode) { txn.begin(mode); } | ||
@Override public void commit() { txn.commit(); } | ||
@Override public void abort() { txn.abort(); } | ||
@Override public boolean isInTransaction() { return txn.isInTransaction(); } | ||
@Override public void end() { txn.end(); } | ||
@Override public boolean supportsTransactions() { return true; } | ||
// Because there are never any changes, abort() means "finish". | ||
@Override public boolean supportsTransactionAbort() { return true; } | ||
|
||
@Override | ||
public Iterator<Node> listGraphNodes() { | ||
return Iter.nullIterator(); | ||
} | ||
|
||
@Override | ||
protected Iterator<Quad> findInDftGraph(Node s, Node p, Node o) { | ||
return Iter.nullIterator(); | ||
} | ||
|
||
@Override | ||
protected Iterator<Quad> findInSpecificNamedGraph(Node g, Node s, Node p, Node o) { | ||
return Iter.nullIterator(); | ||
} | ||
|
||
@Override | ||
protected Iterator<Quad> findInAnyNamedGraphs(Node s, Node p, Node o) { | ||
return Iter.nullIterator(); | ||
} | ||
|
||
@Override | ||
public Graph getDefaultGraph() { | ||
return dftGraph; | ||
} | ||
|
||
@Override | ||
public Graph getGraph(Node graphNode) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void add(Quad quad) { unsupportedMethod(this, "add") ; } | ||
|
||
@Override | ||
public void delete(Quad quad) { unsupportedMethod(this, "delete") ; } | ||
|
||
@Override | ||
public void deleteAny(Node g, Node s, Node p, Node o) { | ||
throw new UnsupportedOperationException("deleteAny"); | ||
} | ||
|
||
@Override | ||
public void setDefaultGraph(Graph g) { | ||
throw new UnsupportedOperationException("setDefaultGraph"); | ||
} | ||
|
||
@Override | ||
public void addGraph(Node graphName, Graph graph) { | ||
throw new UnsupportedOperationException("addGraph"); | ||
} | ||
|
||
@Override | ||
public void removeGraph(Node graphName) { | ||
throw new UnsupportedOperationException("removeGraph"); | ||
} | ||
} |
Oops, something went wrong.