jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [37/51] [partial] jena git commit: Rename com.hp.hpl.jena.* as org.apache.jena.*
Date Thu, 23 Apr 2015 19:56:53 GMT
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetImpl.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetImpl.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetImpl.java
deleted file mode 100644
index a6e529b..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetImpl.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core;
-
-import java.util.Iterator ;
-import java.util.concurrent.Callable ;
-
-import org.apache.jena.atlas.lib.Cache ;
-import org.apache.jena.atlas.lib.CacheFactory ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.NodeFactory ;
-import com.hp.hpl.jena.query.Dataset ;
-import com.hp.hpl.jena.query.LabelExistsException ;
-import com.hp.hpl.jena.query.ReadWrite ;
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.rdf.model.ModelFactory ;
-import com.hp.hpl.jena.shared.Lock ;
-import com.hp.hpl.jena.sparql.ARQException ;
-import com.hp.hpl.jena.sparql.util.Context ;
-import com.hp.hpl.jena.sparql.util.NodeUtils ;
-
-/** A implementation of a Dataset.
- * This is the "usual" implementation based on wrapping a DatasetGraph
- * and providing an adapter layer from Model/Resource to Graph/Node
- * The characteristics of this adapter depend on the characteristics of
- * DatasetGraph.   
- */
-
-public class DatasetImpl implements Dataset
-{
-    /* 
-     * We are cautious - SPARQL Update can change the graphs in a store
-     * so we assume DatasetGraph.getGraph is efficient and
-     * here cut the overhead of model wrappers.
-     */
-
-    protected DatasetGraph dsg = null ;
-    private Transactional transactional = null ;
-    // Cache of graph -> model so that we don't churn model creation.
-    private Cache<Graph, Model> cache = createCache() ;
-    private Object internalLock = new Object() ;
-
-    //private DatasetImpl() {}
-    
-    protected DatasetImpl(DatasetGraph dsg)
-    {
-        this.dsg = dsg ;
-        if ( dsg instanceof Transactional )
-            this.transactional = (Transactional)dsg ; 
-    }
-    /** Wrap an existing DatasetGraph */
-    public static Dataset wrap(DatasetGraph datasetGraph)
-    {
-        DatasetImpl ds = new DatasetImpl(datasetGraph) ;
-        return ds ;
-    }
-    
-    /** Clone the structure of a DatasetGraph.
-     * The current graph themselves are shared but new naming and new graphs are
-     * only in the cloned    
-     */
-    public static Dataset cloneStructure(DatasetGraph datasetGraph)
-    { 
-        return new DatasetImpl(new DatasetGraphMap(datasetGraph)) ;
-    }
-
-    /** Create a Dataset with the model as default model.
-     *  Named models must be explicitly added to identify the storage to be used.
-     */
-    public DatasetImpl(Model model)
-    {
-        addToCache(model) ;
-        this.dsg = DatasetGraphFactory.create(model.getGraph()) ;
-    }
-
-    public DatasetImpl(Dataset ds)
-    {
-        this.dsg = DatasetGraphFactory.create(ds.asDatasetGraph()) ;
-    }
-
-    @Override
-    public Model getDefaultModel() 
-    { 
-        synchronized(internalLock)
-        {
-            return graph2model(dsg.getDefaultGraph()) ;
-        }
-    }
-
-    @Override
-    public Lock getLock() { return dsg.getLock() ; }
-    
-    @Override
-    public Context getContext()
-    {
-        return dsg.getContext() ;
-    }
-    @Override
-    public boolean supportsTransactions()
-    {
-        return (transactional != null) ;
-    }
-
-    @Override public void begin(ReadWrite mode)     
-    {
-        if ( transactional == null )
-            throw new UnsupportedOperationException("Transactions not supported") ;
-        transactional.begin(mode) ;
-    }
-    
-    /** Say whether a transaction is active */ 
-    @Override
-    public boolean isInTransaction()
-    {
-        if ( transactional == null )
-            throw new UnsupportedOperationException("Transactions not supported") ;
-        return transactional.isInTransaction() ;
-    }
-
-    @Override
-    public void commit()
-    {
-        if ( transactional == null )
-            throw new UnsupportedOperationException("Transactions not supported") ;
-        transactional.commit() ;
-    }
-
-    @Override
-    public void abort()
-    {
-        if ( transactional == null )
-            throw new UnsupportedOperationException("Transactions not supported") ;
-        transactional.abort() ;
-    }
-
-    @Override
-    public void end()
-    {
-        if ( transactional == null )
-            throw new UnsupportedOperationException("Transactions not supported") ;
-        transactional.end() ;
-    }
-
-    @Override
-    public DatasetGraph asDatasetGraph() { return dsg ; }
-
-    @Override
-    public Model getNamedModel(String uri)
-    { 
-        checkGraphName(uri) ;
-        Node n = NodeFactory.createURI(uri) ;
-        synchronized(internalLock)
-        {
-            Graph g = dsg.getGraph(n) ;
-            if ( g == null )
-                return null ;
-            return graph2model(g) ;
-        }
-    }
-
-    @Override
-    public void addNamedModel(String uri, Model model) throws LabelExistsException
-    { 
-        checkGraphName(uri) ;
-        // Assumes single writer.
-        addToCache(model) ;
-        Node n = NodeFactory.createURI(uri) ;
-        dsg.addGraph(n, model.getGraph()) ;
-    }
-
-    @Override
-    public void removeNamedModel(String uri)
-    { 
-        checkGraphName(uri) ;
-        Node n = NodeFactory.createURI(uri) ;
-        // Assumes single writer.
-        removeFromCache(dsg.getGraph(n)) ;
-        dsg.removeGraph(n) ;
-    }
-
-    @Override
-    public void replaceNamedModel(String uri, Model model)
-    {
-        // Assumes single writer.
-        checkGraphName(uri) ;
-        Node n = NodeFactory.createURI(uri) ;
-        removeFromCache(dsg.getGraph(n)) ;
-        dsg.removeGraph(n) ;
-        addToCache(model) ;
-        dsg.addGraph(n, model.getGraph() ) ;
-    }
-
-    @Override
-    public void setDefaultModel(Model model)
-    { 
-        if ( model == null )
-            model = ModelFactory.createDefaultModel() ;
-        // Assumes single writer.
-        removeFromCache(dsg.getDefaultGraph()) ;
-        addToCache(model) ;
-        dsg.setDefaultGraph(model.getGraph()) ;
-    }
-
-    @Override
-    public boolean containsNamedModel(String uri)
-    { 
-        // Does not touch the cache.
-        checkGraphName(uri) ;
-        Node n = NodeFactory.createURI(uri) ;
-        return dsg.containsGraph(n) ;
-    }
-
-    @Override
-    public Iterator<String> listNames()
-    { 
-        return NodeUtils.nodesToURIs(dsg.listGraphNodes()) ;
-    }
-
-
-    //  -------
-    //  Cache models wrapping graphs
-    // Assumes outser syncrhonization of necessary (multiple readers possible).
-    // Assume MRSW (Multiple Reader OR Single Writer)
-
-    @Override
-    public void close()
-    {
-        dsg.close() ;
-        cache = null ;
-    }
-
-    protected Cache<Graph, Model> createCache() { return CacheFactory.createCache(100) ; }
-    
-    protected void removeFromCache(Graph graph)
-    {
-        // Assume MRSW - no synchronized needed.
-        if ( graph == null )
-            return ;
-        cache.remove(graph) ;
-    }
-
-    protected void addToCache(Model model)
-    {
-        // Assume MRSW - no synchronized needed.
-        cache.put(model.getGraph(), model) ;
-    }
-
-    protected Model graph2model(final Graph graph)
-    { 
-        Callable<Model> filler = new Callable<Model>() {
-            @Override
-            public Model call() {
-                return ModelFactory.createModelForGraph(graph) ;
-            }
-        } ;
-        return cache.getOrFill(graph, filler) ;
-    }
-    
-    protected static void checkGraphName(String uri)
-    {
-        if ( uri == null )
-            throw new ARQException("null for graph name") ; 
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetPrefixStorage.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetPrefixStorage.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetPrefixStorage.java
deleted file mode 100644
index 9d1276e..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetPrefixStorage.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core;
-
-import java.util.Map ;
-import java.util.Set ;
-
-import org.apache.jena.atlas.lib.Closeable ;
-import org.apache.jena.atlas.lib.Sync ;
-
-import com.hp.hpl.jena.shared.PrefixMapping ;
-
-/** Abstract of prefix storage for graphs in an RDF dataset */
-
-public interface DatasetPrefixStorage extends Closeable, Sync
-{
-    /** Return the set of graph names for which their might be prefix mappings */ 
-    public Set<String> graphNames() ;
-    
-    /** Get the URI string associated with a prefix string for a specific graph (or null) */ 
-    public String readPrefix(String graphName, String prefix) ;
-    /** Get the prefix string associated with a URI string for a specific graph (or null) */ 
-    public String readByURI(String graphName, String uriStr) ;
-    
-    /** Return the mappings for a specific graph.  Do not change this map */ 
-    public Map<String, String> readPrefixMap(String graphName) ;
-    
-    /** Add a prefix mapping for a specific graph */ 
-    public void insertPrefix(String graphName, String prefix, String uri) ;
-    
-    /** Copy in a set of mappings */ 
-    public void loadPrefixMapping(String graphName, PrefixMapping pmap) ;
-
-    /** Remove the association of a prefix for a specific graph */ 
-    public void removeFromPrefixMap(String graphName, String prefix) ;
-
-    /** Return a PrefixMapping for the default (unnamed) graph */ 
-    public PrefixMapping getPrefixMapping() ;
-
-    /** Return a PrefixMapping for a named graph */ 
-    public PrefixMapping getPrefixMapping(String graphName) ;
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DynamicDatasets.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DynamicDatasets.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DynamicDatasets.java
deleted file mode 100644
index 20f5b9d..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DynamicDatasets.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core;
-
-import java.util.Collection ;
-import java.util.Set ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.query.Dataset ;
-import com.hp.hpl.jena.query.DatasetFactory ;
-import com.hp.hpl.jena.sparql.ARQConstants ;
-import com.hp.hpl.jena.sparql.graph.GraphOps ;
-import com.hp.hpl.jena.sparql.graph.GraphUnionRead ;
-import com.hp.hpl.jena.sparql.util.NodeUtils ;
-
-public class DynamicDatasets
-{
-    /** Given a Dataset and a query, form a Dataset that 
-     * is the dynamic dataset from the query.
-     */ 
-    public static Dataset dynamicDataset(DatasetDescription description, Dataset ds, boolean defaultUnionGraph)
-    {
-        DatasetGraph dsg = ds.asDatasetGraph() ;
-        DatasetGraph dsg2 = dynamicDataset(description, dsg, defaultUnionGraph) ;
-        if ( dsg == dsg2 )
-            return ds ;
-        return DatasetFactory.create(dsg2) ;
-    }
-
-    /** Given a DatasetGraph and a query, form a DatasetGraph that 
-     * is the dynamic dataset from the query.
-     * Returns the original DatasetGraph if the dataset description is null.
-     */ 
-    public static DatasetGraph dynamicDataset(DatasetDescription description, DatasetGraph dsg, boolean defaultUnionGraph)
-    {
-        if ( description == null )
-            return dsg ;    
-//    	//An empty description means leave the dataset as-is
-//    	if (description.getDefaultGraphURIs().size() == 0 && description.getNamedGraphURIs().size() == 0) {
-//    		return dsg;
-//    	}
-        Set<Node> defaultGraphs = NodeUtils.convertToNodes(description.getDefaultGraphURIs()) ; 
-        Set<Node> namedGraphs = NodeUtils.convertToNodes(description.getNamedGraphURIs()) ;
-        return dynamicDataset(defaultGraphs, namedGraphs, dsg, defaultUnionGraph) ;
-    }
-    
-    /** Given a DatasetGraph and a query, form a DatasetGraph that 
-     * is the dynamic dataset from the collection of graphs from the dataset
-     * that go to make up the default graph (union) and named graphs.  
-     */
-    public static DatasetGraph dynamicDataset(Collection<Node> defaultGraphs, Collection<Node> namedGraphs, DatasetGraph dsg, boolean defaultUnionGraph)
-    {
-        Graph dft = new GraphUnionRead(dsg, defaultGraphs) ;
-        DatasetGraph dsg2 = new DatasetGraphMap(dft) ;
-        
-        // The named graphs.
-        for ( Node gn : namedGraphs )
-        {
-            Graph g = GraphOps.getGraph(dsg, gn) ;
-            if ( g != null )
-                dsg2.addGraph(gn, g) ;
-        }
-        
-        if ( dsg.getContext() != null )
-            dsg2.getContext().putAll(dsg.getContext()) ;
-
-        if ( defaultUnionGraph && defaultGraphs.size() == 0 )
-        {
-            // Create a union graph - there were no defaultGraphs explicitly named.
-            Graph unionGraph = new GraphUnionRead(dsg, namedGraphs) ;
-            dsg2.setDefaultGraph(unionGraph) ;
-        }
-
-        // read-only, <urn:x-arq:DefaultGraph> and <urn:x-arq:UnionGraph> processing.
-        dsg2 = new DynamicDatasetGraph(dsg2) ;
-        // Record what we've done.
-        // c.f. "ARQConstants.sysDatasetDescription" which is used to pass in a  DatasetDescription
-        dsg2.getContext().set(ARQConstants.symDatasetDefaultGraphs, defaultGraphs) ;
-        dsg2.getContext().set(ARQConstants.symDatasetNamedGraphs,   namedGraphs) ;
-        return dsg2 ;
-    }
-    
-    public static class DynamicDatasetGraph extends DatasetGraphReadOnly
-    {
-        public DynamicDatasetGraph(DatasetGraph dsg)
-        {
-            super(dsg) ;
-        }
-
-        private Graph unionGraph = null ;
-        
-        @Override
-        public boolean containsGraph(Node graphNode)
-        {
-            if ( Quad.isUnionGraph(graphNode) ) return true ;
-            if ( Quad.isDefaultGraphExplicit(graphNode)) return true ;
-            return super.containsGraph(graphNode) ;
-        }
-        
-        // See also the GraphOps
-        @Override
-        public Graph getGraph(Node graphNode)
-        {
-            if ( Quad.isUnionGraph(graphNode) )
-            {
-                if ( unionGraph == null )
-                    unionGraph = GraphOps.unionGraph(super.getWrapped()) ;
-                return unionGraph ;
-            }
-            if ( Quad.isDefaultGraphExplicit(graphNode))
-                return getDefaultGraph() ;
-            
-            return super.getGraph(graphNode) ;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/GraphView.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/GraphView.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/GraphView.java
deleted file mode 100644
index 527fef3..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/GraphView.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * 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 com.hp.hpl.jena.sparql.core;
-
-import java.util.Iterator ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.lib.Sync ;
-import org.apache.jena.riot.other.GLib ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.graph.impl.GraphBase ;
-import com.hp.hpl.jena.shared.JenaException ;
-import com.hp.hpl.jena.shared.PrefixMapping ;
-import com.hp.hpl.jena.shared.impl.PrefixMappingImpl ;
-import com.hp.hpl.jena.sparql.SystemARQ ;
-import com.hp.hpl.jena.util.iterator.ExtendedIterator ;
-import com.hp.hpl.jena.util.iterator.WrappedIterator ;
-
-/** Implement a Graph as a view of the DatasetGraph.
- * 
- *  It maps graph operations to quad operations. 
- */ 
-
-public class GraphView extends GraphBase implements Sync
-{
-    // Beware this implements union graph - implementations may wish
-    // to do better so see protected method below.
-    
-    static class GraphViewException extends JenaException
-    {
-        public GraphViewException()                                  { super(); }
-        public GraphViewException(String message)                    { super(message); }
-        public GraphViewException(Throwable cause)                   { super(cause) ; }
-        public GraphViewException(String message, Throwable cause)   { super(message, cause) ; }
-    }
-    
-    private final DatasetGraph dsg ;
-    private final Node gn ;                 // null for default graph.
-
-    // Factory style.
-    public static GraphView createDefaultGraph(DatasetGraph dsg)
-    { return new GraphView(dsg, Quad.defaultGraphNodeGenerated) ; }
-    
-    public static GraphView createNamedGraph(DatasetGraph dsg, Node graphIRI)
-    { return new GraphView(dsg, graphIRI) ; }
-    
-    public static GraphView createUnionGraph(DatasetGraph dsg)
-    { return new GraphView(dsg, Quad.unionGraph) ; }
-
-    // If inherited.
-    protected GraphView(DatasetGraph dsg, Node gn) {
-        this.dsg = dsg ;
-        this.gn = gn ;
-    }
-
-    /**
-     * Return the graph name for this graph in the dataset it is a view of.
-     * Returns {@code null} for the default graph.
-     */
-    public Node getGraphName() {
-        return (gn == Quad.defaultGraphNodeGenerated) ? null : gn ;
-    }
-
-    /** Return the DatasetGraph we are viewing. */
-    public DatasetGraph getDataset() {
-        return dsg ;
-    }
-    
-    protected final boolean isDefaultGraph() { return isDefaultGraph(gn) ; }
-    protected final boolean isUnionGraph()   { return isUnionGraph(gn) ; }
-
-    protected static final boolean isDefaultGraph(Node gn) { return gn == null || Quad.isDefaultGraph(gn) ; }
-    protected static final boolean isUnionGraph(Node gn)   { return Quad.isUnionGraph(gn) ; }
-    
-    @Override
-    protected PrefixMapping createPrefixMapping() {
-        // TODO Unsatisfactory - need PrefixMap support by DSGs then PrefixMap -> PrefixMapping
-        return new PrefixMappingImpl() ;
-    }
-
-    @Override
-    protected ExtendedIterator<Triple> graphBaseFind(Triple m) {
-        if ( m == null ) m = Triple.ANY ;
-        Node s = m.getMatchSubject() ;
-        Node p = m.getMatchPredicate() ;
-        Node o = m.getMatchObject() ;
-        return graphBaseFind(s, p, o) ;
-    }
-    
-    @Override
-    protected ExtendedIterator<Triple> graphBaseFind(Node s, Node p, Node o) {
-        if ( Quad.isUnionGraph(gn) )
-            return graphUnionFind(s, p, o) ;
-        Node g = graphNode(gn) ;
-        Iterator<Triple> iter = GLib.quads2triples(dsg.find(g, s, p, o)) ;
-        return WrappedIterator.createNoRemove(iter) ;
-    }
-
-    private static Node graphNode(Node gn) {
-        return ( gn == null ) ? Quad.defaultGraphNodeGenerated : gn ;
-    }
-
-    protected ExtendedIterator<Triple> graphUnionFind(Node s, Node p, Node o) {
-        Node g = graphNode(gn) ;
-        // Implementations may wish to do better so this is separated out.
-        // For example, Iter.distinctAdjacent is a lot cheaper than Iter.distinct
-        // but assumes thing come back in a particular order
-        Iterator<Quad> iterQuads = getDataset().find(g, s, p, o) ;
-        Iterator<Triple> iter = GLib.quads2triples(iterQuads) ;
-        // Suppress duplicates after projecting to triples.
-        iter = Iter.distinct(iter) ;
-        return WrappedIterator.createNoRemove(iter) ;
-    }
-    
-    @Override
-    public void performAdd( Triple t ) { 
-        Node g = graphNode(gn) ;
-        if ( Quad.isUnionGraph(g) )
-            throw new GraphViewException("Can't update the default union graph of a dataset") ; 
-        Node s = t.getSubject() ;
-        Node p = t.getPredicate() ;
-        Node o = t.getObject() ;
-        dsg.add(g, s, p, o) ;
-    }
-
-    @Override
-    public void performDelete( Triple t ) {
-        Node g = graphNode(gn) ;
-        if ( Quad.isUnionGraph(g) )
-            throw new GraphViewException("Can't update the default union graph of a dataset") ; 
-        Node s = t.getSubject() ;
-        Node p = t.getPredicate() ;
-        Node o = t.getObject() ;
-        dsg.delete(g, s, p, o) ;
-    }
-
-    @Override
-    public void sync() {
-        SystemARQ.sync(dsg);
-    }
-    
-    // Need to call GraphBase.close() or sent the protected closed flag.
-    //@Override public void close() { super.close() ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/PathBlock.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/PathBlock.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/PathBlock.java
deleted file mode 100644
index 22fb0cc..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/PathBlock.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core;
-
-import java.util.ArrayList ;
-import java.util.List ;
-import java.util.ListIterator ;
-
-import com.hp.hpl.jena.sparql.util.Iso ;
-import com.hp.hpl.jena.sparql.util.NodeIsomorphismMap ;
-
-/** A class whose purpose is to give a name to a collection of triple paths. */ 
-
-public class PathBlock implements Iterable<TriplePath>
-{
-    private List<TriplePath> triplePaths = new ArrayList<>() ;
-
-    public PathBlock() {}
-    public PathBlock(PathBlock other) {triplePaths.addAll(other.triplePaths) ; }
-    
-    public void add(TriplePath tp) { triplePaths.add(tp) ; }
-    public void addAll(PathBlock other) { triplePaths.addAll(other.triplePaths) ; }
-    public void add(int i, TriplePath tp) { triplePaths.add(i, tp) ; }
-    
-    public TriplePath get(int i) { return triplePaths.get(i) ; }
-    @Override
-    public ListIterator<TriplePath> iterator() { return triplePaths.listIterator() ; } 
-    public int size() { return triplePaths.size() ; }
-    public boolean isEmpty() { return triplePaths.isEmpty() ; }
-    
-    public List<TriplePath> getList() { return triplePaths ; } 
-    
-    @Override
-    public int hashCode() { return triplePaths.hashCode() ; } 
-    
-    @Override
-    public boolean equals(Object other)
-    { 
-        if ( this == other ) return true ;
-        if ( ! ( other instanceof PathBlock) ) 
-            return false ;
-        PathBlock bp = (PathBlock)other ;
-        return triplePaths.equals(bp.triplePaths) ;
-    }
-    
-    public boolean equiv(PathBlock other, NodeIsomorphismMap isoMap)
-    { 
-        if ( this.triplePaths.size() != other.triplePaths.size() )
-            return false ;
-        
-        for ( int i = 0 ; i < this.triplePaths.size() ; i++ )
-        {
-            TriplePath tp1 = get(i) ;
-            TriplePath tp2 = other.get(i) ;
-            
-            if ( ! Iso.triplePathIso(tp1, tp2, isoMap) )
-                return false ;
-        }
-        return true ;
-    }
-    
-    @Override
-    public String toString()
-    {
-        return triplePaths.toString() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Prologue.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Prologue.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Prologue.java
deleted file mode 100644
index 34c254e..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Prologue.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core;
-
-import com.hp.hpl.jena.shared.PrefixMapping ;
-import com.hp.hpl.jena.shared.impl.PrefixMappingImpl ;
-
-import org.apache.jena.atlas.lib.Lib ;
-import org.apache.jena.atlas.logging.Log ;
-import org.apache.jena.riot.system.IRIResolver ;
-
-import com.hp.hpl.jena.sparql.util.PrefixMapping2 ;
-
-/** Prologue - combines with PrefixMapping (the RIOT Prologue uses PrefixMap) */
-public class Prologue
-{
-    protected boolean seenBaseURI = false ;     // Implicit or set.
-//    protected String baseURI = null ;
-
-    protected PrefixMapping prefixMap = null ;
-    protected IRIResolver resolver = null ;
-    
-    public Prologue() { prefixMap = new PrefixMappingImpl() ; }
-    
-    public Prologue(PrefixMapping pmap)
-    { 
-        this.prefixMap = pmap ; 
-        this.resolver = null ;
-    }
-    
-    public Prologue(PrefixMapping pmap, String base)
-    { 
-        this.prefixMap = pmap ;
-        setBaseURI(base) ;
-    }
-    
-    public Prologue(PrefixMapping pmap, IRIResolver resolver)
-    {
-        this.prefixMap = pmap ; 
-        this.resolver = resolver ;
-    }
-    
-    public Prologue(Prologue other)
-    {
-        this.prefixMap = other.prefixMap ; 
-        this.resolver = other.resolver ;
-    }
-
-    public Prologue copy()
-    {
-        PrefixMapping prefixMap = new PrefixMappingImpl() ;
-        prefixMap.setNsPrefixes(this.prefixMap) ;
-        String baseURI = null ;
-        if ( resolver != null)
-            baseURI = resolver.getBaseIRIasString() ;
-        
-        return new Prologue(prefixMap, baseURI) ;
-    }
-    
-    // Reverse of sub()
-    public void usePrologueFrom(Prologue other)
-    {
-        prefixMap = new PrefixMapping2(other.prefixMap) ;
-        seenBaseURI = false ;
-        if ( other.resolver != null )
-            resolver = IRIResolver.create(getBaseURI()) ;
-    }
-    
-    public Prologue sub(PrefixMapping newMappings) { return sub(newMappings, null) ; }
-    public Prologue sub(String base) { return sub(null, base) ; }
-    
-    public Prologue sub(PrefixMapping newMappings, String base)
-    {
-        // New prefix mappings
-        PrefixMapping ext = getPrefixMapping() ;
-        if ( newMappings != null )
-            ext = new PrefixMapping2(ext, newMappings) ;
-        // New base.
-        IRIResolver r = resolver ;
-        if ( base != null )
-            r = IRIResolver.create(base) ;
-        return new Prologue(ext, r) ;
-    }
-    
-    /**
-     * @return True if the query has an explicitly set base URI. 
-     */
-    public boolean explicitlySetBaseURI() { return seenBaseURI ; }
-
-    /**
-     * @return Returns the baseURI, if set.
-     */
-    public String getBaseURI()
-    {
-        if ( resolver == null )
-            return null ;
-        return resolver.getBaseIRIasString();
-    }
-    /**
-     * @param baseURI The baseURI to set.
-     */
-    public void setBaseURI(String baseURI)
-    {
-        this.seenBaseURI = true ;
-        this.resolver = IRIResolver.create(baseURI) ; 
-    }
-    
-    /**
-     * @param resolver IRI resolver
-     */
-    public void setBaseURI(IRIResolver resolver)
-    {
-        this.seenBaseURI = true ;
-        this.resolver = resolver ; 
-    }
-    
-    // ---- Query prefixes
-    
-    /** Set a prefix for this query */
-    public void setPrefix(String prefix, String expansion)
-    {
-        try {
-            // Removal may involve regeneration of the reverse mapping
-            // so only do if needed.   
-            String oldExpansion = prefixMap.getNsPrefixURI(prefix) ;
-            if ( Lib.equal(oldExpansion, expansion) )
-                return ;
-            if ( oldExpansion != null )
-                prefixMap.removeNsPrefix(prefix) ;
-            
-            prefixMap.setNsPrefix(prefix, expansion) ;
-        } catch (PrefixMapping.IllegalPrefixException ex)
-        {
-            Log.warn(this, "Illegal prefix mapping(ignored): "+prefix+"=>"+expansion) ;
-        }
-    }   
-
-    /** Return the prefix map from the parsed query */ 
-    public PrefixMapping getPrefixMapping() { return prefixMap ; }
-    /** Set the mapping */
-    public void setPrefixMapping(PrefixMapping pmap ) { prefixMap = pmap ; }
-
-    /** Lookup a prefix for this query, including the default prefixes */
-    public String getPrefix(String prefix)
-    {
-        return prefixMap.getNsPrefixURI(prefix) ;
-    }
-
-    /** Get the IRI resolver */
-    public IRIResolver getResolver() { return resolver ; }
-    
-    /** Set the IRI resolver */
-    public void setResolver(IRIResolver resolver) { this.resolver = resolver; }
-    
-    /** Expand prefixed name 
-     * 
-     * @param prefixed  The prefixed name to be expanded
-     * @return URI, or null if not expanded.
-     */
-
-    public String expandPrefixedName(String prefixed)
-    {
-        //From PrefixMappingImpl.expandPrefix( String prefixed )
-        int colon = prefixed.indexOf( ':' );
-        if (colon < 0) 
-            return null ;
-        else {
-            String prefix = prefixed.substring( 0, colon ) ;
-            String uri = prefixMap.getNsPrefixURI(prefix);
-            if ( uri == null )
-                return null ;
-            return uri + prefixed.substring( colon + 1 );
-        }
-    }
-    
-    /** Use the prefix map to turn a URI into a qname, or return the original URI */
-    
-    public String shortForm(String uri)
-    {
-        return prefixMap.shortForm(uri) ;
-    }
-    
-    /** Test whether a Prologue wil perform the same as this one. */
-    public boolean samePrologue(Prologue other) {
-        // Prologue are mutable and superclasses so .equals is left as the default.
-        String base1 = explicitlySetBaseURI() ? getBaseURI() : null ;
-        String base2 = other.explicitlySetBaseURI() ? other.getBaseURI() : null ;        
-        if (! Lib.equal(base1,  base2) )
-            return false ;
-        if ( getPrefixMapping() == null && other.getPrefixMapping() == null )
-            return true ;
-        if ( getPrefixMapping() == null )
-            return false ;
-        return getPrefixMapping().samePrefixMappingAs(other.getPrefixMapping()) ;    
-    }
-
-    // Caution.
-    // Prologues are inherited (historical).
-    // This is support code.
-    
-    public static int hash(Prologue prologue) {
-        final int prime = 31 ;
-        int x = 1 ; 
-        if ( prologue.seenBaseURI )
-            x = prime * x + prologue.getBaseURI().hashCode() ;
-        else
-            x = 1237 ;
-        if ( prologue.prefixMap != null )
-            x = prime * x + prologue.prefixMap.getNsPrefixMap().hashCode() ;
-        return x ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Quad.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Quad.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Quad.java
deleted file mode 100644
index fb3216f..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Quad.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core;
-
-import static org.apache.jena.atlas.lib.Lib.equal ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.NodeFactory ;
-import com.hp.hpl.jena.graph.Triple ;
-
-public class Quad
-{
-    // Create QuadNames? GraphNames?
-    
-    /** Name of the default graph as used by parsers and in quad form of algebra. 
-     *  Not for access to the default graph by name - use Quad.defaultGraphIRI.
-     */ 
-    public static final Node defaultGraphNodeGenerated     =  NodeFactory.createURI("urn:x-arq:DefaultGraphNode") ;
-    
-    // These are convenience constants for other systems to give special
-    // interpretation to these "named" graphs.  
-    
-    /** Name of the default for explict use in GRAPH */
-    public static final Node defaultGraphIRI        =  NodeFactory.createURI("urn:x-arq:DefaultGraph") ;
-
-    /** Name of the merge of all named graphs (use this for the graph of all named graphs) */
-    public static final Node unionGraph           =  NodeFactory.createURI("urn:x-arq:UnionGraph") ;
-
-    /** Name of the non-graph when a quad is really a triple - also parsing of triples formats 
-     *  (and the default graph when parsing N-Quads or TriG) 
-     *  Not for access to the default graph by name - use Quad.defaultGraphIRI.
-     */
-    public static final Node tripleInQuad           =  null ;
-    
-    private final Node graph, subject, predicate, object ;
-    
-    public Quad(Node graph, Triple triple)
-    {
-        this(graph, triple.getSubject(), triple.getPredicate(), triple.getObject()) ;
-    }
-    
-    public Quad(Node g, Node s, Node p, Node o)
-    {
-        // Null means it's a triple really.
-        //if ( g == null ) throw new UnsupportedOperationException("Quad: graph cannot be null");
-        if ( s == null ) throw new UnsupportedOperationException("Quad: subject cannot be null");
-        if ( p == null ) throw new UnsupportedOperationException("Quad: predicate cannot be null");
-        if ( o == null ) throw new UnsupportedOperationException("Quad: object cannot be null");
-        this.graph = g ;
-        this.subject = s ;
-        this.predicate = p ;
-        this.object = o ;
-    }
-    
-    public static Quad create(Node g, Node s, Node p, Node o)   { return new Quad(g,s,p,o) ; }
-    public static Quad create(Node g, Triple t)                 { return new Quad(g,t) ; }
-
-    public final Node getGraph()      { return graph ; }
-    public final Node getSubject()    { return subject ; }
-    public final Node getPredicate()  { return predicate ; }
-    public final Node getObject()     { return object ; }
-
-    /** Get as a triple - useful because quads often come in blocks for the same graph */  
-    public Triple asTriple()
-    { 
-        return new Triple(subject, predicate, object) ;
-    }
-    
-    public boolean isConcrete()
-    {
-        return subject.isConcrete() && predicate.isConcrete() && object.isConcrete() && graph.isConcrete() ;
-    }
-    
-    /** Test whether this is a quad for the default graph (not the default graphs by explicit name) */
-    public static boolean isDefaultGraphGenerated(Node node)
-    {
-        // The node used by the quad generator for the default graph 
-        // Not the named graph that refers to the default graph.
-        return defaultGraphNodeGenerated.equals(node) ;
-    }
-    
-    /** Default, concrete graph (either generated or explicitly named) -- not triple-in-quad*/
-    public static boolean isDefaultGraphExplicit(Node node)
-    {
-        return defaultGraphIRI.equals(node) ; 
-    }
-    
-    /** Default, concrete graph (either generated or explicitly named) -- not triple-in-quad*/
-    public static boolean isDefaultGraph(Node node)
-    {
-        return isDefaultGraphGenerated(node) || isDefaultGraphExplicit(node) ; 
-    }
-
-    /** Default, concrete graph (either generated or explicitly named) -- not triple-in-quad*/
-    public static boolean isUnionGraph(Node node)
-    {
-        return unionGraph.equals(node) ; 
-    }
-
-
-    /** Default, concrete graph via generated URI (not explciitly named) */
-    public boolean isDefaultGraphExplicit()
-    { return isDefaultGraphExplicit(getGraph()) ; }
-    
-    /** Default graph, explicitly named (not generated) */
-    public boolean isDefaultGraphGenerated()
-    {
-        return  isDefaultGraphGenerated(getGraph()) ;
-    }
-
-    /** Default, concrete graph (either generated or explicitly named) */
-    public boolean isDefaultGraph()
-    {
-        return  isDefaultGraph(getGraph()) ;
-    }
-    
-    /** node used for the RDF merge of named graphs */
-//    public static boolean isQuadUnionGraph(Node node)
-//    {
-//        return node.equals(unionGraph) ;
-//    }
-//    
-    public boolean isUnionGraph()           { return isUnionGraph(graph) ; }
-
-    /** Is it really a triple? */  
-    public boolean isTriple()               { return equal(graph, tripleInQuad) ; } 
-
-    /** Is this quad a legal data quad (legal data triple, IRI for graph) */   
-    public boolean isLegalAsData()
-    {
-        Node sNode = getSubject() ;
-        Node pNode = getPredicate() ;
-        Node oNode = getObject() ;
-        Node gNode = getGraph() ;
-        
-        if ( sNode.isLiteral() || sNode.isVariable() )
-            return false ;
-        
-        if ( ! pNode.isURI() )  // Not variable, literal or blank.
-            return false ;
-
-        if ( oNode.isVariable() )
-            return false ;
-        
-        if ( gNode != null ) {
-            if ( ! gNode.isURI() && ! gNode.isBlank() )
-                return false ;
-        }
-        
-        return true ;
-    }
-    
-    @Override
-    public int hashCode() 
-    { 
-        int x = 
-               (subject.hashCode() >> 1) ^ 
-               predicate.hashCode() ^ 
-               (object.hashCode() << 1);
-        if ( graph != null )
-            x ^= (graph.hashCode()>>2) ;
-        else
-            x++ ;
-        return x ;
-    }
-    
-    
-    
-    @Override
-    public boolean equals(Object other) 
-    { 
-        if ( this == other ) return true ;
-
-        if ( ! ( other instanceof Quad) )
-            return false ;
-        Quad quad = (Quad)other ;
-        
-        if ( ! equal(graph, quad.graph) ) return false ;
-        if ( ! subject.equals(quad.subject) ) return false ;
-        if ( ! predicate.equals(quad.predicate) ) return false ;
-        if ( ! object.equals(quad.object) ) return false ;
-        return true ;
-    }
-    
-    public boolean matches(Node g, Node s, Node p, Node o)
-    {
-        return nodeMatches(getGraph(), g) && nodeMatches(getSubject(), s) &&
-               nodeMatches(getPredicate(), p) && nodeMatches(getObject(), o) ;
-    }
-
-    private static boolean nodeMatches(Node thisNode, Node otherNode)
-    {
-        // otheNode may be Node.ANY, and this works out.
-        return otherNode.matches(thisNode) ;
-    }
-
-    @Override
-    public String toString()
-    {
-        String str = (graph==null)?"_":graph.toString() ;
-        return "["+str+" "+subject.toString()+" "+predicate.toString()+" "+object.toString()+"]" ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QuadAction.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QuadAction.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QuadAction.java
deleted file mode 100644
index a4c926b..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QuadAction.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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 com.hp.hpl.jena.sparql.core;
-
-/** A {@code QuadAction} is record of a type of change to a {@code DatasetGraph}.
- * <p>
- * {@code DatasetGraph} are sets of quads.
- * An {@code add} only affects the state of the {@code DatasetGraph}
- * if a quad of the same value was not present, 
- * and a {@code delete} only affects the state of the {@code DatasetGraph}
- * if a quad was present.
- * <p>
- * A {@code QuadAction} can be an {@code ADD} or {@code DELETE}, indicating a change
- * to the {@code DatasetGraph} actually occured (this assumes checking is done - 
- * {@link DatasetChanges} generators may not check - see implementation for details).
- * Otherwise a {@code NO_ADD}, {@code NO_DELETE} {@code QuadAction} is used.
- */ 
-
-public enum QuadAction {
-    ADD("A"), DELETE("D"), NO_ADD("#A"), NO_DELETE("#D") ;
-    public final String label ;
-    QuadAction(String label) { this.label = label ; }
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QuadPattern.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QuadPattern.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QuadPattern.java
deleted file mode 100644
index 85c96f2..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QuadPattern.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core;
-
-import java.util.ArrayList ;
-import java.util.List ;
-import java.util.ListIterator ;
-
-import org.apache.jena.atlas.io.IndentedLineBuffer ;
-
-import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
-import com.hp.hpl.jena.sparql.sse.SSE ;
-import com.hp.hpl.jena.sparql.sse.writers.WriterNode ;
-import com.hp.hpl.jena.sparql.util.Iso ;
-import com.hp.hpl.jena.sparql.util.NodeIsomorphismMap ;
-
-
-/** A class whose purpose is to give a name to a collection of quads
- */ 
-
-public class QuadPattern implements Iterable<Quad>
-{
-    private List<Quad> quads = new ArrayList<>() ;
-
-    public QuadPattern() {}
-    public QuadPattern(QuadPattern other) {quads.addAll(other.quads) ; }
-    
-    public void add(Quad q) { quads.add(q) ; }
-    public void addAll(QuadPattern other) { quads.addAll(other.quads) ; }
-    public void add(int i, Quad q) { quads.add(i, q) ; }
-    
-    public Quad get(int i) { return quads.get(i) ; }
-    @Override
-    public ListIterator<Quad> iterator() { return quads.listIterator() ; } 
-    public int size() { return quads.size() ; }
-    public boolean isEmpty() { return quads.isEmpty() ; }
-    
-    public List<Quad> getList() { return quads ; } 
-    
-    @Override
-    public int hashCode() { return quads.hashCode() ; } 
-    
-    @Override
-    public boolean equals(Object other) {
-        if ( this == other )
-            return true ;
-        if ( !(other instanceof QuadPattern) )
-            return false ;
-        QuadPattern bp = (QuadPattern)other ;
-        return quads.equals(bp.quads) ;
-    }
-
-    public boolean equiv(QuadPattern other, NodeIsomorphismMap isoMap) {
-        if ( this.quads.size() != other.quads.size() )
-            return false ;
-
-        for (int i = 0; i < this.quads.size(); i++) {
-            Quad q1 = get(i) ;
-            Quad q2 = other.get(i) ;
-
-            if ( !Iso.quadIso(q1, q2, isoMap) )
-                return false ;
-        }
-        return true ;
-    }
-    
-    @Override
-    public String toString() {
-        IndentedLineBuffer out = new IndentedLineBuffer() ;
-
-        SerializationContext sCxt = SSE.sCxt((SSE.defaultPrefixMapWrite)) ;
-
-        boolean first = true ;
-        for (Quad quad : quads) {
-            if ( !first )
-                out.print(" ") ;
-            else
-                first = false ;
-            // Adds (triple ...)
-            // SSE.write(buff.getIndentedWriter(), t) ;
-            out.print("(") ;
-            WriterNode.outputPlain(out, quad, sCxt) ;
-            out.print(")") ;
-        }
-        out.flush() ;
-        return out.toString() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryCheckException.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryCheckException.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryCheckException.java
deleted file mode 100644
index 7ea6401..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryCheckException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core;
-
-import com.hp.hpl.jena.query.QueryException ;
-
-public class QueryCheckException extends QueryException
-{
-    public QueryCheckException() { super() ; }
-    public QueryCheckException(Throwable cause) { super(cause) ; }
-    public QueryCheckException(String msg) { super(msg) ; }
-    public QueryCheckException(String msg, Throwable cause) { super(msg, cause) ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryCompare.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryCompare.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryCompare.java
deleted file mode 100644
index ce49d98..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryCompare.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core ;
-
-import org.apache.jena.atlas.lib.Lib ;
-
-import com.hp.hpl.jena.query.Query ;
-import com.hp.hpl.jena.query.QueryVisitor ;
-import com.hp.hpl.jena.sparql.util.NodeIsomorphismMap ;
-
-// Two queries comparison 
-
-public class QueryCompare implements QueryVisitor
-{
-    private Query   query2 ;
-    private boolean result = true ;
-    static public boolean PrintMessages = false ;
-
-    public static boolean equals(Query query1, Query query2)
-    {
-        if ( query1 == query2 ) return true ;
-        
-        query1.setResultVars() ;
-        query2.setResultVars() ;
-        QueryCompare visitor = new QueryCompare(query1) ;
-        try {
-            query2.visit(visitor) ;
-        } catch ( ComparisonException ex)
-        {
-            return false ;
-        }
-        return visitor.isTheSame() ;
-    }
-    
-    public QueryCompare(Query query2)
-    {
-        this.query2 = query2 ;
-        
-    }
-
-    @Override
-    public void startVisit(Query query1)
-    {  }  
-
-    @Override
-    public void visitResultForm(Query query1)
-    { check("Query result form", query1.getQueryType() == query2.getQueryType()) ; }
-
-    @Override
-    public void visitPrologue(Prologue query1)
-    {
-        check("Prefixes/Base", query1.samePrologue(query2) ) ;
-    }
-
-    @Override
-    public void visitSelectResultForm(Query query1)
-    { 
-        check("Not both SELECT queries", query2.isSelectType()) ;
-        check("DISTINCT modifier",
-              query1.isDistinct() == query2.isDistinct()) ;
-        check("SELECT *", query1.isQueryResultStar() == query2.isQueryResultStar()) ;
-        check("Result variables",   query1.getProject(), query2.getProject() ) ;
-    }
-
-    @Override
-    public void visitConstructResultForm(Query query1)
-    {
-        check("Not both CONSTRUCT queries", query2.isConstructType()) ;
-        check("CONSTRUCT templates", 
-              query1.getConstructTemplate().equalIso(query2.getConstructTemplate(), new NodeIsomorphismMap()) ) ;
-    }
-
-    @Override
-    public void visitDescribeResultForm(Query query1)
-    {
-        check("Not both DESCRIBE queries", query2.isDescribeType()) ;
-        check("Result variables", 
-              query1.getResultVars(), query2.getResultVars() ) ;
-        check("Result URIs", 
-              query1.getResultURIs(), query2.getResultURIs() ) ;
-        
-    }
-
-    @Override
-    public void visitAskResultForm(Query query1)
-    {
-        check("Not both ASK queries", query2.isAskType()) ;
-    }
-
-    @Override
-    public void visitDatasetDecl(Query query1)
-    {
-        boolean b1 = Lib.equalsListAsSet(query1.getGraphURIs(), query2.getGraphURIs()) ;
-        check("Default graph URIs", b1 ) ;
-        boolean b2 = Lib.equalsListAsSet(query1.getNamedGraphURIs(), query2.getNamedGraphURIs()) ; 
-        check("Named graph URIs", b2 ) ;
-    }
-
-    @Override
-    public void visitQueryPattern(Query query1)
-    {
-        if ( query1.getQueryPattern() == null &&
-             query2.getQueryPattern() == null )
-            return ;
-        
-        if ( query1.getQueryPattern() == null ) throw new ComparisonException("Missing pattern") ;
-        if ( query2.getQueryPattern() == null ) throw new ComparisonException("Missing pattern") ;
-        
-        // The checking for patterns (elements) involves a potential
-        // remapping of system-allocated variable names.
-        // Assumes blank node variables only appear in patterns.
-        check("Pattern", query1.getQueryPattern().equalTo(query2.getQueryPattern(), new NodeIsomorphismMap())) ;
-    }
-
-    @Override
-    public void visitGroupBy(Query query1)
-    {
-        check("GROUP BY", query1.getGroupBy(), query2.getGroupBy()) ;
-    }
-    
-    @Override
-    public void visitHaving(Query query1) 
-    {
-        check("HAVING", query1.getHavingExprs(), query2.getHavingExprs()) ;
-    }
-    
-    @Override
-    public void visitLimit(Query query1)
-    {
-        check("LIMIT", query1.getLimit() == query2.getLimit() ) ;
-    }
-
-     @Override
-    public void visitOrderBy(Query query1)
-     {
-         check("ORDER BY", query1.getOrderBy(), query2.getOrderBy() ) ;
-     }
-
-     @Override
-    public void visitOffset(Query query1)
-    {
-        check("OFFSET", query1.getOffset() == query2.getOffset() ) ;
-    }
-
-    @Override
-    public void visitValues(Query query1)
-    {
-        // Must be same order for now.
-        check("VALUES/variables", query1.getValuesVariables(), query2.getValuesVariables()) ;
-        check("VALUES/values", query1.getValuesData(), query2.getValuesData()) ;
-    }
-
-    @Override
-    public void finishVisit(Query query1)
-    {}
-    
-    private void check(String msg, Object obj1, Object obj2)
-    {
-        check(msg, Lib.equal(obj1,obj2)) ;
-    }
-    
-    private void check(String msg, boolean b)
-    {
-        if ( !b )
-        {
-            if ( PrintMessages && msg != null )
-                System.out.println("Different: "+msg) ;
-            result = false ;
-            throw new ComparisonException(msg) ;
-        }
-    }
-
-    public boolean isTheSame() { return result ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryHashCode.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryHashCode.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryHashCode.java
deleted file mode 100644
index d62bc81..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryHashCode.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core ;
-
-
-import com.hp.hpl.jena.query.Query ;
-import com.hp.hpl.jena.query.QueryVisitor ;
-
-//Calculate hashcode (inline with QueryCompare) 
-
-public class QueryHashCode
-{
-    int x = 0 ; 
-
-    public static int calc(Query query)
-    {
-        QueryHashCodeWorker visitor = new QueryHashCodeWorker() ;
-        query.visit(visitor) ;
-        return visitor.calculatedHashCode() ;
-    }
-
-    private static class  QueryHashCodeWorker implements QueryVisitor
-    {
-        int x = 0 ; 
-        public QueryHashCodeWorker()
-        {}
-
-        @Override
-        public void startVisit(Query query)
-        { } 
-
-        @Override
-        public void visitResultForm(Query query)
-        { }
-
-        @Override
-        public void visitPrologue(Prologue query)
-        {
-            x ^= Prologue.hash(query) ;
-        }
-
-        @Override
-        public void visitSelectResultForm(Query query)
-        { 
-            //query.setResultVars() ;
-            if ( ! query.isQueryResultStar() )
-                x^= query.getProject().hashCode() ;
-        }
-
-        @Override
-        public void visitConstructResultForm(Query query)
-        {
-            x ^= query.getConstructTemplate().hashCode() ;
-        }
-
-        @Override
-        public void visitDescribeResultForm(Query query)
-        {
-            x ^= query.getResultVars().hashCode() ;
-            x ^= query.getResultURIs().hashCode() ;
-        }
-
-        @Override
-        public void visitAskResultForm(Query query)
-        { }
-
-        @Override
-        public void visitDatasetDecl(Query query)
-        {
-            x ^= query.getNamedGraphURIs().hashCode() ; 
-        }
-
-        @Override
-        public void visitQueryPattern(Query query)
-        {
-            if ( query.getQueryPattern() != null )
-                x ^= query.getQueryPattern().hashCode() ;
-        }
-
-        @Override
-        public void visitGroupBy(Query query)
-        {
-            if ( query.hasGroupBy() )
-                x ^= query.getGroupBy().hashCode() ;
-        }
-        
-        @Override
-        public void visitHaving(Query query) 
-        {
-            if ( query.hasHaving() )
-                x ^= query.getHavingExprs().hashCode() ;
-        }
-        
-        @Override
-        public void visitOrderBy(Query query)
-        {
-            if ( query.getOrderBy() != null )
-                x ^= query.getOrderBy().hashCode() ;
-        }
-
-        @Override
-        public void visitLimit(Query query)
-        {
-            x ^= query.getLimit() ;
-        }
-
-        @Override
-        public void visitOffset(Query query)
-        {
-            x ^= query.getOffset() ;
-        }
-
-        @Override
-        public void visitValues(Query query)
-        {
-            if ( query.hasValues() )
-            {
-                x ^= query.getValuesVariables().hashCode() ;
-                x ^= query.getValuesData().hashCode() ;
-            }
-        }
-
-        @Override
-        public void finishVisit(Query query)
-        {}
-
-        public int  calculatedHashCode() { return x ; }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QuerySolutionBase.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QuerySolutionBase.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QuerySolutionBase.java
deleted file mode 100644
index 8d0a88f..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QuerySolutionBase.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core;
-
-import java.util.Iterator ;
-
-import com.hp.hpl.jena.query.QuerySolution ;
-import com.hp.hpl.jena.rdf.model.Literal ;
-import com.hp.hpl.jena.rdf.model.RDFNode ;
-import com.hp.hpl.jena.rdf.model.Resource ;
-
-/** Implementation of QuerySolution that contains the canonicalization and casting code. */ 
-
-public abstract class QuerySolutionBase implements QuerySolution
-{
-    @Override
-    public RDFNode get(String varName)          { return _get(Var.canonical(varName)) ; }
-    
-    protected abstract RDFNode _get(String varName) ; 
-
-    @Override
-    public Resource getResource(String varName) { return (Resource)get(varName) ; } 
-
-    @Override
-    public Literal getLiteral(String varName)   { return (Literal)get(varName) ; }
-
-    @Override
-    public boolean contains(String varName)     { return _contains(Var.canonical(varName)) ; }  
-
-    protected abstract boolean _contains(String varName) ;
-    
-    @Override
-    public abstract Iterator<String> varNames() ;
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/ResultBinding.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/ResultBinding.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/ResultBinding.java
deleted file mode 100644
index 6726e3c..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/ResultBinding.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core;
-
-import java.util.ArrayList ;
-import java.util.Iterator ;
-import java.util.List ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.rdf.model.RDFNode ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.engine.binding.BindingBase ;
-import com.hp.hpl.jena.sparql.util.ModelUtils ;
-
-
-/** A mapping from variable name to an RDF value.
- *  A wrapper around the graph level Binding. */
-
-
-public class ResultBinding extends QuerySolutionBase
-{
-    Binding binding ;
-    Model model ;
-
-    public ResultBinding( Model _model, Binding _binding)
-    {
-        model = _model ;
-        binding = _binding ;
-    }
-    
-//    private ResultBinding( Model _model )
-//    {
-//        model = _model ;
-//        binding = BindingFactory.create() ;
-//    }
-    
-    @Override
-    protected RDFNode _get(String varName)
-    {
-        Node n = binding.get(Var.alloc(varName)) ;
-        if ( n == null )
-            return null;
-        return ModelUtils.convertGraphNodeToRDFNode(n, model) ;
-    }
-    
-    @Override
-    protected boolean _contains(String varName)
-    {
-        return binding.contains(Var.alloc(varName)) ;
-    }
-
-    @Override
-    public Iterator<String> varNames()
-    { 
-        List<String> x = new ArrayList<>() ;
-        for ( Iterator<Var> iter = binding.vars() ; iter.hasNext(); )
-        {
-            Var v = iter.next();
-            x.add(v.getVarName()) ;
-        }
-        return x.iterator() ;
-    }
-    
-//    public void setModel(Model m) { model = m ; }
-//    public Model getModel() { return model ; }
-
-    public Binding getBinding() { return binding ; }
-    
-    @Override
-    public String toString()
-    {
-        if ( binding == null )
-            return "<no binding>" ;
-        return binding.toString() ;
-    }
-
-    public static boolean equals(ResultBinding rb1, ResultBinding rb2)
-    {
-        return BindingBase.equals(rb1.getBinding(), rb2.getBinding() ) ; 
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Substitute.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Substitute.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Substitute.java
deleted file mode 100644
index e235596..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Substitute.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core;
-
-import java.util.ArrayList ;
-import java.util.List ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.sparql.algebra.Op ;
-import com.hp.hpl.jena.sparql.algebra.TransformCopy ;
-import com.hp.hpl.jena.sparql.algebra.Transformer ;
-import com.hp.hpl.jena.sparql.algebra.op.* ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.engine.binding.BindingFactory ;
-import com.hp.hpl.jena.sparql.expr.Expr ;
-import com.hp.hpl.jena.sparql.expr.ExprList ;
-import com.hp.hpl.jena.sparql.pfunction.PropFuncArg ;
-
-public class Substitute
-{
-    public static Op substitute(Op op, Binding binding)
-    {
-        // Want to avoid cost if the binding is empty 
-        // but the empty test is not zero-cost on non-empty things.
-     
-        if ( isNotNeeded(binding) ) return op ;
-        return Transformer.transform(new OpSubstituteWorker(binding), op) ;
-    }
-    
-    public static Op substitute(Op op, Var var, Node node)
-    {
-        Binding b = BindingFactory.binding(var, node) ;
-        return substitute(op, b) ;
-    }
-    
-    public static BasicPattern substitute(BasicPattern bgp, Binding binding)
-    {
-        if ( isNotNeeded(binding) ) return bgp ;
-        
-        BasicPattern bgp2 = new BasicPattern() ;
-        for ( Triple triple : bgp )
-        {
-            Triple t = substitute(triple, binding) ;
-            bgp2.add(t) ;
-        }
-        return bgp2 ;
-    }
-    
-    public static Triple substitute(Triple triple, Binding binding)
-    {
-        if ( isNotNeeded(binding) ) return triple ;
-        
-        Node s = triple.getSubject() ;
-        Node p = triple.getPredicate() ;
-        Node o = triple.getObject() ;
-        
-        Node s1 = substitute(s, binding) ;
-        Node p1 = substitute(p, binding) ;
-        Node o1 = substitute(o, binding) ;
-
-        Triple t = triple ;
-        if ( s1 != s || p1 != p || o1 != o )
-            t = new Triple(s1, p1, o1) ;
-        return t ;
-    }
-
-    public static TriplePath substitute(TriplePath triplePath, Binding binding)
-    {
-        if ( triplePath.isTriple() )
-            return new TriplePath(Substitute.substitute(triplePath.asTriple(), binding)) ;
-  
-        Node s = triplePath.getSubject() ;
-        Node o = triplePath.getObject() ;
-        Node s1 = substitute(s, binding) ;
-        Node o1 = substitute(o, binding) ;
-        
-        TriplePath tp = triplePath ;
-        if ( s1 != s || o1 != o )
-            tp = new TriplePath(s1, triplePath.getPath(), o1) ;
-        return tp ;
-    }
-    
-    public static Quad substitute(Quad quad, Binding binding)
-    {
-        if ( isNotNeeded(binding) ) return quad ;
-        
-        Node g = quad.getGraph() ;
-        Node s = quad.getSubject() ;
-        Node p = quad.getPredicate() ;
-        Node o = quad.getObject() ;
-        
-        Node g1 = substitute(g, binding) ;
-        Node s1 = substitute(s, binding) ;
-        Node p1 = substitute(p, binding) ;
-        Node o1 = substitute(o, binding) ;
-
-        Quad q = quad ;
-        if ( s1 != s || p1 != p || o1 != o || g1 != g )
-            q = new Quad(g1, s1, p1, o1) ;
-        return q ;
-    }
-
-
-    public static Node substitute(Node n, Binding b)
-    {
-        return Var.lookup(b, n) ;
-    }
-    
-    public static PropFuncArg substitute(PropFuncArg propFuncArg, Binding binding)
-    {
-        if ( isNotNeeded(binding) ) return propFuncArg ;
-        
-        if ( propFuncArg.isNode() ) {
-            Node n = propFuncArg.getArg() ;
-            if ( ! Var.isVar(n) )
-                // Not a Var, no substitute needed. 
-                return propFuncArg ;
-            return new PropFuncArg(substitute(propFuncArg.getArg(), binding)) ;
-        }
-        
-        List<Node> newArgList = new ArrayList<>() ;
-        for ( Node n : propFuncArg.getArgList() )
-            newArgList.add(substitute(n, binding)) ;
-        return new PropFuncArg(newArgList) ;
-    }
-    
-    public static Expr substitute(Expr expr, Binding binding)
-    {
-        if ( isNotNeeded(binding) ) return expr ;
-        return expr.copySubstitute(binding) ;  
-    }
-    
-    public static ExprList substitute(ExprList exprList, Binding binding)
-    {
-        if ( isNotNeeded(binding) ) return exprList ;
-        return exprList.copySubstitute(binding) ;  
-    }
-    
-    private static boolean isNotNeeded(Binding b)
-    {
-        return b == null || b.isEmpty() ; 
-    }
-    
-    // ----
-    private static class OpSubstituteWorker extends TransformCopy
-    {
-        private Binding binding ;
-
-        public OpSubstituteWorker(Binding binding) 
-        {
-            super(TransformCopy.COPY_ALWAYS) ;
-            this.binding = binding ;
-        }
-
-        @Override
-        public Op transform(OpBGP opBGP)
-        {
-            BasicPattern bgp = opBGP.getPattern() ;
-            bgp = substitute(bgp, binding) ;
-            return new OpBGP(bgp) ;
-        }
-
-        @Override
-        public Op transform(OpQuadPattern quadPattern)
-        {
-            Node gNode = quadPattern.getGraphNode() ;
-            Node g = substitute(gNode, binding) ;
-
-            BasicPattern triples = new BasicPattern() ;
-            for ( Triple triple : quadPattern.getBasicPattern() )
-            {
-                Node s = substitute(triple.getSubject(), binding) ;
-                Node p = substitute(triple.getPredicate(), binding) ;
-                Node o = substitute(triple.getObject(), binding) ;
-                Triple t = new Triple(s, p, o) ;
-                triples.add(t) ;
-            }
-            
-            // Pure quading.
-//            for ( Iterator iter = quadPattern.getQuads().iterator() ; iter.hasNext() ; )
-//            {
-//                Quad quad = (Quad)iter.next() ;
-//                if ( ! quad.getGraph().equals(gNode) )
-//                    throw new ARQInternalErrorException("Internal error: quads block is not uniform over the graph node") ;
-//                Node s = substitute(quad.getSubject(), binding) ;
-//                Node p = substitute(quad.getPredicate(), binding) ;
-//                Node o = substitute(quad.getObject(), binding) ;
-//                Triple t = new Triple(s, p, o) ;
-//                triples.add(t) ;
-//            }
-
-            return new OpQuadPattern(g, triples) ;
-        }
-
-        @Override
-        public Op transform(OpPath opPath)
-        {
-            return new OpPath(substitute(opPath.getTriplePath(), binding)) ;
-        }
-
-        @Override
-        public Op transform(OpPropFunc opPropFunc, Op subOp)
-        {
-            PropFuncArg sArgs = opPropFunc.getSubjectArgs() ;
-            PropFuncArg oArgs = opPropFunc.getObjectArgs() ;
-            
-            PropFuncArg sArgs2 = substitute(sArgs, binding) ;
-            PropFuncArg oArgs2 = substitute(oArgs, binding) ;
-            
-            if ( sArgs2 == sArgs && oArgs2 == oArgs && opPropFunc.getSubOp() == subOp)
-                return super.transform(opPropFunc, subOp) ;
-            return new OpPropFunc(opPropFunc.getProperty(), sArgs2, oArgs2, subOp) ; 
-        }
-        
-        @Override
-        public Op transform(OpFilter filter, Op op)
-        {
-            ExprList exprs = filter.getExprs().copySubstitute(binding) ;
-            if ( exprs == filter.getExprs() )
-                return filter ;
-            return OpFilter.filter(exprs, op) ; 
-        }
-
-        @Override
-        public Op transform(OpAssign opAssign, Op subOp)
-        { 
-            VarExprList varExprList2 = transformVarExprList(opAssign.getVarExprList()) ;
-            if ( varExprList2.isEmpty() )
-                return subOp ;
-            return OpAssign.assign(subOp, varExprList2) ;
-        }
-        
-        @Override
-        public Op transform(OpExtend opExtend, Op subOp)
-        { 
-            VarExprList varExprList2 = transformVarExprList(opExtend.getVarExprList()) ;
-            if ( varExprList2.isEmpty() )
-                return subOp ;
-            
-            return OpExtend.create(subOp, varExprList2) ;
-        }
-        
-        private  VarExprList transformVarExprList(VarExprList varExprList)
-        {
-            VarExprList varExprList2 = new VarExprList() ;
-            for ( Var v : varExprList.getVars() )
-            {
-//                if ( binding.contains(v))
-//                    // Already bound. No need to do anything because the 
-//                    // logical assignment will test value.  
-//                    continue ;
-                Expr expr = varExprList.getExpr(v) ;
-                expr = expr.copySubstitute(binding) ;
-                varExprList2.add(v, expr) ;
-            }
-            return varExprList2 ;
-        }
-        
-
-        // The expression?
-        //public Op transform(OpLeftJoin opLeftJoin, Op left, Op right)   { return xform(opLeftJoin, left, right) ; }
-        
-        @Override
-        public Op transform(OpGraph op, Op sub)
-        {
-            Node n = substitute(op.getNode(), binding) ;
-            return new OpGraph(n, sub) ;
-        }
-
-        @Override
-        public Op transform(OpService op, Op sub)
-        {
-            Node n = substitute(op.getService(), binding) ;
-            return new OpService(n, sub, op.getSilent()) ;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Transactional.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Transactional.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Transactional.java
deleted file mode 100644
index b63d436..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/Transactional.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core;
-
-import com.hp.hpl.jena.query.ReadWrite ;
-
-/** Interface that encapulsated begin/abort|commit/close.
- * <p>The read lifcycle is:
- * <pre>  begin(READ) ... end()</pre>
- * <p>The write lifcycle is:
- * <pre>  begin(WRITE) ... abort() or commit() [end()is optional]</pre>
- * 
- */
-public interface Transactional 
-{
-    /** Start either a READ or WRITE transaction */ 
-    public void begin(ReadWrite readWrite) ;
-    
-    /** Commit a transaction - finish the transaction and make any changes permanent (if a "write" transaction) */  
-    public void commit() ;
-    
-    /** Abort a transaction - finish the transaction and undo any changes (if a "write" transaction) */  
-    public void abort() ;
-
-    /** Say whether a transaction is active */ 
-    public boolean isInTransaction() ;
-    
-    /** Finish the transaction - if a write transaction and commit() has not been called, then abort */  
-    public void end() ;
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/TransactionalNull.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/TransactionalNull.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/TransactionalNull.java
deleted file mode 100644
index b528bb3..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/TransactionalNull.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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 com.hp.hpl.jena.sparql.core;
-
-import com.hp.hpl.jena.query.ReadWrite ;
-
-public class TransactionalNull implements Transactional
-{
-    boolean inTransaction = false ;
-    
-    @Override
-    public void begin(ReadWrite readWrite)
-    {
-        inTransaction = true ;
-    }
-
-    @Override
-    public void commit()
-    {
-        inTransaction = false ;
-    }
-
-    @Override
-    public void abort()
-    {
-        inTransaction = false ;
-    }
-
-    @Override
-    public boolean isInTransaction()
-    {
-        return inTransaction ;
-    }
-
-    @Override
-    public void end()
-    {
-        inTransaction = false ;
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/TriplePath.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/TriplePath.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/TriplePath.java
deleted file mode 100644
index 116b24c..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/TriplePath.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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 com.hp.hpl.jena.sparql.core;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.sparql.path.P_Link ;
-import com.hp.hpl.jena.sparql.path.Path ;
-
-import org.apache.jena.atlas.logging.Log ;
-
-/** Like a triple except it can be a path or a triple.  
- * The triple can have a variable predicate.  
- * There may be no "path".
- */ 
-
-public final class TriplePath
-{
-    private final Node subject ;
-    private final Node predicate ;
-    private final Path path ;
-    private final Node object ;
-    private Triple triple = null ;
-    private int hash = -1 ;
-
-    // Maybe "de P_Link" all this.
-    
-    public TriplePath(Node s, Path path, Node o)
-    {
-        this.subject = s ;
-        this.object = o ;
-        if ( path instanceof P_Link )
-        {
-            this.predicate = ((P_Link)path).getNode() ;
-            triple = new Triple(subject, this.predicate , o) ;
-        } else
-            this.predicate = null ;
-        this.path = path ;
-    }
-    
-    public TriplePath(Triple triple)
-    {
-        this.subject = triple.getSubject() ;
-        // Canonicalise: A triple and a path with a using P_Link of a URI 
-        Node p = triple.getPredicate() ;
-        if ( p.isURI() )
-        {
-            this.path = new P_Link(triple.getPredicate()) ;
-            this.predicate = p ;
-        }
-        else
-        {   
-            this.path = null ;
-            this.predicate = triple.getPredicate() ;
-        }
-//        this.path = null ;
-//        this.predicate = triple.getPredicate() ;
-        this.object = triple.getObject() ;
-        this.triple = triple ; 
-        if ( triple.getPredicate() == null )
-            Log.warn(this, "Triple predicate is null") ;
-    }
-
-    public Node getSubject()    { return subject ; }
-    public Path getPath()       { return path ; }       // Maybe null (it's a triple).
-    public Node getPredicate()  { return predicate ; }  // Maybe null (it's a path).
-    public Node getObject()     { return object ; }
-
-    public boolean isTriple()
-    {
-        return (triple != null || predicate != null) ;
-    }
-    
-    /** Return as a triple when the path is a simple, 1-link, else return null */ 
-    public Triple asTriple()
-    { 
-        if ( triple != null )
-            return triple ;
-        
-        if ( path instanceof P_Link )
-            triple = new Triple(subject, ((P_Link)path).getNode(), object) ;
-        return triple ;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        if ( hash == -1 )
-        {
-            if ( isTriple() )
-                hash = asTriple().hashCode() ;
-            else
-                hash = (subject.hashCode()<<2) ^ path.hashCode() ^ (object.hashCode()<<1) ;
-        }
-        return hash ;
-    }
-    
-    @Override
-    public boolean equals(Object other)
-    {
-        if ( this == other) return true ;
-        if ( ! ( other instanceof TriplePath) )
-            return false ;
-        TriplePath tp = (TriplePath)other ;
-
-        // True if one is true and one is false
-        if ( tp.isTriple() ^ this.isTriple() )
-            return false ;
-        if ( isTriple() )
-            return asTriple().equals(tp.asTriple()) ;
-        else        
-            return subject.equals(tp.subject) && object.equals(tp.object) && path.equals(tp.path) ;
-    }
-    
-    @Override
-    public String toString()
-    {
-        if ( path != null )
-            return subject+" ("+path+") "+object ;
-        else
-            return subject+" "+predicate+" "+object ;
-    }
-}


Mime
View raw message