jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [5/5] jena git commit: Convert tabs to spaces.
Date Fri, 11 Dec 2015 09:33:17 GMT
Convert tabs to spaces.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/8f22481f
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/8f22481f
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/8f22481f

Branch: refs/heads/master
Commit: 8f22481f02f159bb8de36f2de59e8aed54743322
Parents: 45ab88f
Author: Andy Seaborne <andy@apache.org>
Authored: Fri Dec 11 09:31:31 2015 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Fri Dec 11 09:31:31 2015 +0000

----------------------------------------------------------------------
 .../core/mem/DatasetPrefixStorageInMemory.java  | 126 ++---
 .../jena/sparql/core/mem/FourTupleMap.java      |  98 ++--
 .../jena/sparql/core/mem/GraphInMemory.java     |  28 +-
 .../apache/jena/sparql/core/mem/HexTable.java   | 160 +++---
 .../jena/sparql/core/mem/PMapQuadTable.java     | 194 ++++----
 .../jena/sparql/core/mem/PMapTripleTable.java   | 160 +++---
 .../jena/sparql/core/mem/PMapTupleTable.java    | 168 +++----
 .../apache/jena/sparql/core/mem/QuadTable.java  |  60 +--
 .../jena/sparql/core/mem/QuadTableForm.java     | 492 +++++++++----------
 .../apache/jena/sparql/core/mem/TriTable.java   | 146 +++---
 .../jena/sparql/core/mem/TripleTable.java       |  26 +-
 .../jena/sparql/core/mem/TripleTableForm.java   | 258 +++++-----
 .../apache/jena/sparql/core/mem/TupleSlot.java  |   2 +-
 .../apache/jena/sparql/core/mem/TupleTable.java |  40 +-
 .../jena/sparql/core/mem/package-info.java      |   2 +-
 15 files changed, 980 insertions(+), 980 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetPrefixStorageInMemory.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetPrefixStorageInMemory.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetPrefixStorageInMemory.java
index da9ce8e..e405c4e 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetPrefixStorageInMemory.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetPrefixStorageInMemory.java
@@ -33,67 +33,67 @@ import org.apache.jena.sparql.core.DatasetPrefixStorage;
  */
 public class DatasetPrefixStorageInMemory implements DatasetPrefixStorage {
 
-	private Map<String, PrefixMapping> prefixMappings = new ConcurrentHashMap<>();
-
-	/**
-	 * A mapping from graph name to {@link PrefixMapping} for that graph.
-	 */
-	private Map<String, PrefixMapping> prefixMappings() {
-		return prefixMappings;
-	}
-
-	@Override
-	public void close() {
-		prefixMappings = null;
-	}
-
-	@Override
-	public void sync() {
-		// NO OP
-	}
-
-	@Override
-	public Set<String> graphNames() {
-		return prefixMappings().keySet();
-	}
-
-	@Override
-	public String readPrefix(final String graphName, final String prefix) {
-		return getPrefixMapping(graphName).getNsPrefixURI(prefix);
-	}
-
-	@Override
-	public String readByURI(final String graphName, final String uriStr) {
-		return getPrefixMapping(graphName).getNsURIPrefix(uriStr);
-	}
-
-	@Override
-	public Map<String, String> readPrefixMap(final String graphName) {
-		return getPrefixMapping(graphName).getNsPrefixMap();
-	}
-
-	@Override
-	public void insertPrefix(final String graphName, final String prefix, final String uri) {
-		getPrefixMapping(graphName).setNsPrefix(prefix, uri);
-	}
-
-	@Override
-	public void loadPrefixMapping(final String graphName, final PrefixMapping pmap) {
-		getPrefixMapping(graphName).setNsPrefixes(pmap);
-	}
-
-	@Override
-	public void removeFromPrefixMap(final String graphName, final String prefix) {
-		getPrefixMapping(graphName).removeNsPrefix(prefix);
-	}
-
-	@Override
-	public PrefixMapping getPrefixMapping() {
-		return getPrefixMapping(defaultGraphIRI.getURI());
-	}
-
-	@Override
-	public PrefixMapping getPrefixMapping(final String graphName) {
-		return prefixMappings().computeIfAbsent(graphName, x -> new PrefixMappingImpl());
-	}
+    private Map<String, PrefixMapping> prefixMappings = new ConcurrentHashMap<>();
+
+    /**
+     * A mapping from graph name to {@link PrefixMapping} for that graph.
+     */
+    private Map<String, PrefixMapping> prefixMappings() {
+        return prefixMappings;
+    }
+
+    @Override
+    public void close() {
+        prefixMappings = null;
+    }
+
+    @Override
+    public void sync() {
+        // NO OP
+    }
+
+    @Override
+    public Set<String> graphNames() {
+        return prefixMappings().keySet();
+    }
+
+    @Override
+    public String readPrefix(final String graphName, final String prefix) {
+        return getPrefixMapping(graphName).getNsPrefixURI(prefix);
+    }
+
+    @Override
+    public String readByURI(final String graphName, final String uriStr) {
+        return getPrefixMapping(graphName).getNsURIPrefix(uriStr);
+    }
+
+    @Override
+    public Map<String, String> readPrefixMap(final String graphName) {
+        return getPrefixMapping(graphName).getNsPrefixMap();
+    }
+
+    @Override
+    public void insertPrefix(final String graphName, final String prefix, final String uri) {
+        getPrefixMapping(graphName).setNsPrefix(prefix, uri);
+    }
+
+    @Override
+    public void loadPrefixMapping(final String graphName, final PrefixMapping pmap) {
+        getPrefixMapping(graphName).setNsPrefixes(pmap);
+    }
+
+    @Override
+    public void removeFromPrefixMap(final String graphName, final String prefix) {
+        getPrefixMapping(graphName).removeNsPrefix(prefix);
+    }
+
+    @Override
+    public PrefixMapping getPrefixMapping() {
+        return getPrefixMapping(defaultGraphIRI.getURI());
+    }
+
+    @Override
+    public PrefixMapping getPrefixMapping(final String graphName) {
+        return prefixMappings().computeIfAbsent(graphName, x -> new PrefixMappingImpl());
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/FourTupleMap.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/FourTupleMap.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/FourTupleMap.java
index c96956b..2def198 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/FourTupleMap.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/FourTupleMap.java
@@ -30,62 +30,62 @@ import com.github.andrewoma.dexx.collection.Map;
  */
 public class FourTupleMap extends PMap<Node, ThreeTupleMap, FourTupleMap> {
 
-	private FourTupleMap(final com.github.andrewoma.dexx.collection.Map<Node, ThreeTupleMap> wrappedMap) {
-		super(wrappedMap);
-	}
+    private FourTupleMap(final com.github.andrewoma.dexx.collection.Map<Node, ThreeTupleMap> wrappedMap) {
+        super(wrappedMap);
+    }
 
-	/**
-	 * Default constructor.
-	 */
-	public FourTupleMap() {
-		super();
-	}
+    /**
+     * Default constructor.
+     */
+    public FourTupleMap() {
+        super();
+    }
 
-	@Override
-	protected FourTupleMap wrap(final Map<Node, ThreeTupleMap> wrappedMap) {
-		return new FourTupleMap(wrappedMap);
-	}
+    @Override
+    protected FourTupleMap wrap(final Map<Node, ThreeTupleMap> wrappedMap) {
+        return new FourTupleMap(wrappedMap);
+    }
 
-	/**
-	 * A {@link PMap} of {@link Node}s: {@code Node->Node->PersistentSet<Node>}
-	 */
-	public static class ThreeTupleMap extends PMap<Node, TwoTupleMap, ThreeTupleMap> {
-		private ThreeTupleMap(final com.github.andrewoma.dexx.collection.Map<Node, TwoTupleMap> wrappedMap) {
-			super(wrappedMap);
-		}
+    /**
+     * A {@link PMap} of {@link Node}s: {@code Node->Node->PersistentSet<Node>}
+     */
+    public static class ThreeTupleMap extends PMap<Node, TwoTupleMap, ThreeTupleMap> {
+        private ThreeTupleMap(final com.github.andrewoma.dexx.collection.Map<Node, TwoTupleMap> wrappedMap) {
+            super(wrappedMap);
+        }
 
-		/**
-		 * Default constructor.
-		 */
-		public ThreeTupleMap() {
-			super();
-		}
+        /**
+         * Default constructor.
+         */
+        public ThreeTupleMap() {
+            super();
+        }
 
-		@Override
-		protected ThreeTupleMap wrap(final Map<Node, TwoTupleMap> wrappedMap) {
-			return new ThreeTupleMap(wrappedMap);
-		}
-	}
+        @Override
+        protected ThreeTupleMap wrap(final Map<Node, TwoTupleMap> wrappedMap) {
+            return new ThreeTupleMap(wrappedMap);
+        }
+    }
 
-	/**
-	 * A {@link PMap} of {@link Node}s: {@code Node->PersistentSet<Node>}
-	 */
-	public static class TwoTupleMap extends PMap<Node, PersistentSet<Node>, TwoTupleMap> {
+    /**
+     * A {@link PMap} of {@link Node}s: {@code Node->PersistentSet<Node>}
+     */
+    public static class TwoTupleMap extends PMap<Node, PersistentSet<Node>, TwoTupleMap> {
 
-		private TwoTupleMap(final com.github.andrewoma.dexx.collection.Map<Node, PersistentSet<Node>> wrappedMap) {
-			super(wrappedMap);
-		}
+        private TwoTupleMap(final com.github.andrewoma.dexx.collection.Map<Node, PersistentSet<Node>> wrappedMap) {
+            super(wrappedMap);
+        }
 
-		/**
-		 * Default constructor.
-		 */
-		public TwoTupleMap() {
-			super();
-		}
+        /**
+         * Default constructor.
+         */
+        public TwoTupleMap() {
+            super();
+        }
 
-		@Override
-		protected TwoTupleMap wrap(final Map<Node, PersistentSet<Node>> wrappedMap) {
-			return new TwoTupleMap(wrappedMap);
-		}
-	}
+        @Override
+        protected TwoTupleMap wrap(final Map<Node, PersistentSet<Node>> wrappedMap) {
+            return new TwoTupleMap(wrappedMap);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/GraphInMemory.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/GraphInMemory.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/GraphInMemory.java
index 78cad2d..53c864f 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/GraphInMemory.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/GraphInMemory.java
@@ -30,21 +30,21 @@ import org.apache.jena.sparql.core.GraphView;
  */
 public class GraphInMemory extends GraphView {
 
-	private final DatasetGraphInMemory datasetGraph;
+    private final DatasetGraphInMemory datasetGraph;
 
-	GraphInMemory(final DatasetGraphInMemory dsg, final Node gn) {
-		super(dsg, gn);
-		this.datasetGraph = dsg;
-	}
+    GraphInMemory(final DatasetGraphInMemory dsg, final Node gn) {
+        super(dsg, gn);
+        this.datasetGraph = dsg;
+    }
 
-	@Override
-	protected PrefixMapping createPrefixMapping() {
-		final DatasetPrefixStorage prefixes = datasetGraph().prefixes();
-		return isDefaultGraph() || isUnionGraph() ? prefixes.getPrefixMapping() : prefixes
-				.getPrefixMapping(getGraphName().getURI());
-	}
+    @Override
+    protected PrefixMapping createPrefixMapping() {
+        final DatasetPrefixStorage prefixes = datasetGraph().prefixes();
+        return isDefaultGraph() || isUnionGraph() ? prefixes.getPrefixMapping() : prefixes
+            .getPrefixMapping(getGraphName().getURI());
+    }
 
-	private DatasetGraphInMemory datasetGraph() {
-		return datasetGraph;
-	}
+    private DatasetGraphInMemory datasetGraph() {
+        return datasetGraph;
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/HexTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/HexTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/HexTable.java
index b532c72..a0997cf 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/HexTable.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/HexTable.java
@@ -42,84 +42,84 @@ import org.apache.jena.sparql.core.Quad;
  */
 public class HexTable implements QuadTable {
 
-	private final ThreadLocal<Boolean> isInTransaction = withInitial(() -> false);
-
-	@Override
-	public boolean isInTransaction() {
-		return isInTransaction.get();
-	}
-
-	protected void isInTransaction(final boolean b) {
-		isInTransaction.set(b);
-	}
-
-	private final Map<QuadTableForm, QuadTable> indexBlock = new EnumMap<QuadTableForm, QuadTable>(
-			tableForms().collect(toMap(x -> x, QuadTableForm::get)));
-
-	/**
-	 * A block of six indexes to which we provide access as though they were one.
-	 */
-	protected Map<QuadTableForm, QuadTable> indexBlock() {
-		return indexBlock;
-	}
-
-	@Override
-	public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
-		final Set<TupleSlot> pattern = noneOf(TupleSlot.class);
-		if (isConcrete(g)) pattern.add(GRAPH);
-		if (isConcrete(s)) pattern.add(SUBJECT);
-		if (isConcrete(p)) pattern.add(PREDICATE);
-		if (isConcrete(o)) pattern.add(OBJECT);
-		final QuadTableForm choice = chooseFrom(pattern);
-		return indexBlock().get(choice).find(g, s, p, o);
-	}
-
-	private static boolean isConcrete(final Node n) {
-		return nonNull(n) && n.isConcrete();
-	}
-
-	@Override
-	public void add(final Quad q) {
-		indexBlock().values().forEach(index -> index.add(q));
-	}
-
-	@Override
-	public void delete(final Quad q) {
-		indexBlock().values().forEach(index -> index.delete(q));
-	}
-
-	@Override
-	public Stream<Node> listGraphNodes() {
-		// GSPO is specially equipped with an efficient listGraphNodes().
-		return indexBlock().get(GSPO).listGraphNodes();
-	}
-
-	@Override
-	public Stream<Quad> findInUnionGraph(final Node s, final Node p, final Node o) {
-		// we can use adjacency in SPOG to solve this problem without building up a set of already-seen triples.
-		return indexBlock().get(SPOG).findInUnionGraph(s, p, o);
-	}
-
-	@Override
-	public void begin(final ReadWrite rw) {
-		isInTransaction(true);
-		indexBlock().values().forEach(table -> table.begin(rw));
-	}
-
-	@Override
-	public void end() {
-		indexBlock().values().forEach(QuadTable::end);
-		isInTransaction.remove();
-	}
-
-	@Override
-	public void commit() {
-		indexBlock().values().forEach(QuadTable::commit);
-		isInTransaction(false);
-	}
-
-	@Override
-	public void clear() {
-		indexBlock().values().forEach(QuadTable::clear);
-	}
+    private final ThreadLocal<Boolean> isInTransaction = withInitial(() -> false);
+
+    @Override
+    public boolean isInTransaction() {
+        return isInTransaction.get();
+    }
+
+    protected void isInTransaction(final boolean b) {
+        isInTransaction.set(b);
+    }
+
+    private final Map<QuadTableForm, QuadTable> indexBlock = new EnumMap<QuadTableForm, QuadTable>(
+        tableForms().collect(toMap(x -> x, QuadTableForm::get)));
+
+    /**
+     * A block of six indexes to which we provide access as though they were one.
+     */
+    protected Map<QuadTableForm, QuadTable> indexBlock() {
+        return indexBlock;
+    }
+
+    @Override
+    public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
+        final Set<TupleSlot> pattern = noneOf(TupleSlot.class);
+        if (isConcrete(g)) pattern.add(GRAPH);
+        if (isConcrete(s)) pattern.add(SUBJECT);
+        if (isConcrete(p)) pattern.add(PREDICATE);
+        if (isConcrete(o)) pattern.add(OBJECT);
+        final QuadTableForm choice = chooseFrom(pattern);
+        return indexBlock().get(choice).find(g, s, p, o);
+    }
+
+    private static boolean isConcrete(final Node n) {
+        return nonNull(n) && n.isConcrete();
+    }
+
+    @Override
+    public void add(final Quad q) {
+        indexBlock().values().forEach(index -> index.add(q));
+    }
+
+    @Override
+    public void delete(final Quad q) {
+        indexBlock().values().forEach(index -> index.delete(q));
+    }
+
+    @Override
+    public Stream<Node> listGraphNodes() {
+        // GSPO is specially equipped with an efficient listGraphNodes().
+        return indexBlock().get(GSPO).listGraphNodes();
+    }
+
+    @Override
+    public Stream<Quad> findInUnionGraph(final Node s, final Node p, final Node o) {
+        // we can use adjacency in SPOG to solve this problem without building up a set of already-seen triples.
+        return indexBlock().get(SPOG).findInUnionGraph(s, p, o);
+    }
+
+    @Override
+    public void begin(final ReadWrite rw) {
+        isInTransaction(true);
+        indexBlock().values().forEach(table -> table.begin(rw));
+    }
+
+    @Override
+    public void end() {
+        indexBlock().values().forEach(QuadTable::end);
+        isInTransaction.remove();
+    }
+
+    @Override
+    public void commit() {
+        indexBlock().values().forEach(QuadTable::commit);
+        isInTransaction(false);
+    }
+
+    @Override
+    public void clear() {
+        indexBlock().values().forEach(QuadTable::clear);
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java
index b281759..9606c6f 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java
@@ -39,111 +39,111 @@ import org.slf4j.Logger;
  */
 public abstract class PMapQuadTable extends PMapTupleTable<FourTupleMap, Quad>implements QuadTable {
 
-	/**
-	 * @param tableName a name for this table
-	 */
-	public PMapQuadTable(final String tableName) {
-		super(tableName);
-	}
+    /**
+     * @param tableName a name for this table
+     */
+    public PMapQuadTable(final String tableName) {
+        super(tableName);
+    }
 
-	private static final Logger log = getLogger(PMapQuadTable.class);
+    private static final Logger log = getLogger(PMapQuadTable.class);
 
-	@Override
-	protected Logger log() {
-		return log;
-	}
+    @Override
+    protected Logger log() {
+        return log;
+    }
 
-	@Override
-	protected FourTupleMap initial() {
-		return new FourTupleMap();
-	}
+    @Override
+    protected FourTupleMap initial() {
+        return new FourTupleMap();
+    }
 
-	/**
-	 * Constructs a {@link Quad} from the nodes given, using the appropriate order for this table. E.g. a OPSG table
-	 * should return a {@code Quad} using ({@code fourth}, {@code third}, {@code second}, {@code first}).
-	 *
-	 * @param first
-	 * @param second
-	 * @param third
-	 * @param fourth
-	 * @return a {@code Quad}
-	 */
-	protected abstract Quad quad(final Node first, final Node second, final Node third, final Node fourth);
+    /**
+     * Constructs a {@link Quad} from the nodes given, using the appropriate order for this table. E.g. a OPSG table
+     * should return a {@code Quad} using ({@code fourth}, {@code third}, {@code second}, {@code first}).
+     *
+     * @param first
+     * @param second
+     * @param third
+     * @param fourth
+     * @return a {@code Quad}
+     */
+    protected abstract Quad quad(final Node first, final Node second, final Node third, final Node fourth);
 
-	/**
-	 * We descend through the nested {@link PMap}s building up {@link Stream}s of partial tuples from which we develop a
-	 * {@link Stream} of full tuples which is our result. Use {@link Node#ANY} or <code>null</code> for a wildcard.
-	 *
-	 * @param first the value in the first slot of the tuple
-	 * @param second the value in the second slot of the tuple
-	 * @param third the value in the third slot of the tuple
-	 * @param fourth the value in the fourth slot of the tuple
-	 * @return a <code>Stream</code> of tuples matching the pattern
-	 */
-	@SuppressWarnings("unchecked") // Because of (Stream<Quad>) -- but why is that needed?
+    /**
+     * We descend through the nested {@link PMap}s building up {@link Stream}s of partial tuples from which we develop a
+     * {@link Stream} of full tuples which is our result. Use {@link Node#ANY} or <code>null</code> for a wildcard.
+     *
+     * @param first the value in the first slot of the tuple
+     * @param second the value in the second slot of the tuple
+     * @param third the value in the third slot of the tuple
+     * @param fourth the value in the fourth slot of the tuple
+     * @return a <code>Stream</code> of tuples matching the pattern
+     */
+    @SuppressWarnings("unchecked") // Because of (Stream<Quad>) -- but why is that needed?
     protected Stream<Quad> _find(final Node first, final Node second, final Node third, final Node fourth) {
-		debug("Querying on four-tuple pattern: {} {} {} {} .", first, second, third, fourth);
-		final FourTupleMap fourTuples = local().get();
-		if (isConcrete(first)) {
-			debug("Using a specific first slot value.");
-			return (Stream<Quad>) fourTuples.get(first).map(threeTuples -> {
-				if (isConcrete(second)) {
-					debug("Using a specific second slot value.");
-					return threeTuples.get(second).map(twoTuples -> {
-						if (isConcrete(third)) {
-							debug("Using a specific third slot value.");
-							return twoTuples.get(third).map(oneTuples -> {
-								if (isConcrete(fourth)) {
-									debug("Using a specific fourth slot value.");
-									return oneTuples
-											.contains(fourth) ? of(quad(first, second, third, fourth)) : empty();
-								}
-								debug("Using a wildcard fourth slot value.");
-								return oneTuples.stream().map(slot4 -> quad(first, second, third, slot4));
-							}).orElse(empty());
+        debug("Querying on four-tuple pattern: {} {} {} {} .", first, second, third, fourth);
+        final FourTupleMap fourTuples = local().get();
+        if (isConcrete(first)) {
+            debug("Using a specific first slot value.");
+            return (Stream<Quad>) fourTuples.get(first).map(threeTuples -> {
+                if (isConcrete(second)) {
+                    debug("Using a specific second slot value.");
+                    return threeTuples.get(second).map(twoTuples -> {
+                        if (isConcrete(third)) {
+                            debug("Using a specific third slot value.");
+                            return twoTuples.get(third).map(oneTuples -> {
+                                if (isConcrete(fourth)) {
+                                    debug("Using a specific fourth slot value.");
+                                    return oneTuples
+                                        .contains(fourth) ? of(quad(first, second, third, fourth)) : empty();
+                                }
+                                debug("Using a wildcard fourth slot value.");
+                                return oneTuples.stream().map(slot4 -> quad(first, second, third, slot4));
+                            }).orElse(empty());
 
-						}
-						debug("Using wildcard third and fourth slot values.");
-						return twoTuples.flatten((slot3, oneTuples) -> oneTuples.stream()
-								.map(slot4 -> quad(first, second, slot3, slot4)));
-					}).orElse(empty());
-				}
-				debug("Using wildcard second, third and fourth slot values.");
-				return threeTuples.flatten((slot2, twoTuples) -> twoTuples.flatten(
-						(slot3, oneTuples) -> oneTuples.stream().map(slot4 -> quad(first, slot2, slot3, slot4))));
-			}).orElse(empty());
-		}
-		debug("Using a wildcard for all slot values.");
-		return fourTuples.flatten((slot1, threeTuples) -> threeTuples.flatten((slot2, twoTuples) -> twoTuples
-				.flatten((slot3, oneTuples) -> oneTuples.stream().map(slot4 -> quad(slot1, slot2, slot3, slot4)))));
-	}
+                        }
+                        debug("Using wildcard third and fourth slot values.");
+                        return twoTuples.flatten((slot3, oneTuples) -> oneTuples.stream()
+                                                 .map(slot4 -> quad(first, second, slot3, slot4)));
+                    }).orElse(empty());
+                }
+                debug("Using wildcard second, third and fourth slot values.");
+                return threeTuples.flatten((slot2, twoTuples) -> twoTuples.flatten(
+                                                                                   (slot3, oneTuples) -> oneTuples.stream().map(slot4 -> quad(first, slot2, slot3, slot4))));
+            }).orElse(empty());
+        }
+        debug("Using a wildcard for all slot values.");
+        return fourTuples.flatten((slot1, threeTuples) -> threeTuples.flatten((slot2, twoTuples) -> twoTuples
+                                                                              .flatten((slot3, oneTuples) -> oneTuples.stream().map(slot4 -> quad(slot1, slot2, slot3, slot4)))));
+    }
 
-	protected void _add(final Node first, final Node second, final Node third, final Node fourth) {
-		debug("Adding four-tuple: {} {} {} {} .", first, second, third, fourth);
-		final FourTupleMap fourTuples = local().get();
-		ThreeTupleMap threeTuples = fourTuples.get(first).orElse(new ThreeTupleMap());
-		TwoTupleMap twoTuples = threeTuples.get(second).orElse(new TwoTupleMap());
-		PersistentSet<Node> oneTuples = twoTuples.get(third).orElse(PersistentSet.empty());
+    protected void _add(final Node first, final Node second, final Node third, final Node fourth) {
+        debug("Adding four-tuple: {} {} {} {} .", first, second, third, fourth);
+        final FourTupleMap fourTuples = local().get();
+        ThreeTupleMap threeTuples = fourTuples.get(first).orElse(new ThreeTupleMap());
+        TwoTupleMap twoTuples = threeTuples.get(second).orElse(new TwoTupleMap());
+        PersistentSet<Node> oneTuples = twoTuples.get(third).orElse(PersistentSet.empty());
 
-		if (!oneTuples.contains(fourth)) oneTuples = oneTuples.plus(fourth);
-		twoTuples = twoTuples.minus(third).plus(third, oneTuples);
-		threeTuples = threeTuples.minus(second).plus(second, twoTuples);
-		debug("Setting transactional index to new value.");
-		local().set(fourTuples.minus(first).plus(first, threeTuples));
-	}
+        if (!oneTuples.contains(fourth)) oneTuples = oneTuples.plus(fourth);
+        twoTuples = twoTuples.minus(third).plus(third, oneTuples);
+        threeTuples = threeTuples.minus(second).plus(second, twoTuples);
+        debug("Setting transactional index to new value.");
+        local().set(fourTuples.minus(first).plus(first, threeTuples));
+    }
 
-	protected void _delete(final Node first, final Node second, final Node third, final Node fourth) {
-		debug("Removing four-tuple: {} {} {} {} .", first, second, third, fourth);
-		final FourTupleMap fourTuples = local().get();
-		fourTuples.get(first).ifPresent(threeTuples -> threeTuples.get(second)
-				.ifPresent(twoTuples -> twoTuples.get(third).ifPresent(oneTuples -> {
-					if (oneTuples.contains(fourth)) {
-						oneTuples = oneTuples.minus(fourth);
-						final TwoTupleMap newTwoTuples = twoTuples.minus(third).plus(third, oneTuples);
-						final ThreeTupleMap newThreeTuples = threeTuples.minus(second).plus(second, newTwoTuples);
-						debug("Setting transactional index to new value.");
-						local().set(fourTuples.minus(first).plus(first, newThreeTuples));
-					}
-				})));
-	}
+    protected void _delete(final Node first, final Node second, final Node third, final Node fourth) {
+        debug("Removing four-tuple: {} {} {} {} .", first, second, third, fourth);
+        final FourTupleMap fourTuples = local().get();
+        fourTuples.get(first).ifPresent(threeTuples -> threeTuples.get(second)
+                                        .ifPresent(twoTuples -> twoTuples.get(third).ifPresent(oneTuples -> {
+                                            if (oneTuples.contains(fourth)) {
+                                                oneTuples = oneTuples.minus(fourth);
+                                                final TwoTupleMap newTwoTuples = twoTuples.minus(third).plus(third, oneTuples);
+                                                final ThreeTupleMap newThreeTuples = threeTuples.minus(second).plus(second, newTwoTuples);
+                                                debug("Setting transactional index to new value.");
+                                                local().set(fourTuples.minus(first).plus(first, newThreeTuples));
+                                            }
+                                        })));
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTripleTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTripleTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTripleTable.java
index 2e79baf..dcb83ef 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTripleTable.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTripleTable.java
@@ -37,93 +37,93 @@ import org.slf4j.Logger;
  */
 public abstract class PMapTripleTable extends PMapTupleTable<ThreeTupleMap, Triple>implements TripleTable {
 
-	private final static Logger log = getLogger(PMapTripleTable.class);
+    private final static Logger log = getLogger(PMapTripleTable.class);
 
-	@Override
-	protected Logger log() {
-		return log;
-	}
+    @Override
+    protected Logger log() {
+        return log;
+    }
 
-	@Override
-	protected ThreeTupleMap initial() {
-		return new ThreeTupleMap();
-	}
+    @Override
+    protected ThreeTupleMap initial() {
+        return new ThreeTupleMap();
+    }
 
-	/**
-	 * @param tableName a name for this table
-	 */
-	public PMapTripleTable(final String tableName) {
-		super(tableName);
-	}
+    /**
+     * @param tableName a name for this table
+     */
+    public PMapTripleTable(final String tableName) {
+        super(tableName);
+    }
 
-	/**
-	 * We descend through the nested {@link PMap}s building up {@link Stream}s of partial tuples from which we develop a
-	 * {@link Stream} of full tuples which is our result. Use {@link Node#ANY} or <code>null</code> for a wildcard.
-	 *
-	 * @param first the value in the first slot of the tuple
-	 * @param second the value in the second slot of the tuple
-	 * @param third the value in the third slot of the tuple
-	 * @return a <code>Stream</code> of tuples matching the pattern
-	 */
-	@SuppressWarnings("unchecked") // Because of (Stream<Triple>) -- but why is that needed?
+    /**
+     * We descend through the nested {@link PMap}s building up {@link Stream}s of partial tuples from which we develop a
+     * {@link Stream} of full tuples which is our result. Use {@link Node#ANY} or <code>null</code> for a wildcard.
+     *
+     * @param first the value in the first slot of the tuple
+     * @param second the value in the second slot of the tuple
+     * @param third the value in the third slot of the tuple
+     * @return a <code>Stream</code> of tuples matching the pattern
+     */
+    @SuppressWarnings("unchecked") // Because of (Stream<Triple>) -- but why is that needed?
     public Stream<Triple> _find(final Node first, final Node second, final Node third) {
-		debug("Querying on three-tuple pattern: {} {} {} .", first, second, third);
-		final ThreeTupleMap threeTuples = local().get();
-		if (isConcrete(first)) {
-			debug("Using a specific first slot value.");
-			return (Stream<Triple>) threeTuples.get(first).map(twoTuples -> {
-				if (isConcrete(second)) {
-					debug("Using a specific second slot value.");
-					return twoTuples.get(second).map(oneTuples -> {
-						if (isConcrete(third)) {
-							debug("Using a specific third slot value.");
-							return oneTuples.contains(third) ? Stream.of(triple(first, second, third)) : empty();
-						}
-						debug("Using a wildcard third slot value.");
-						return oneTuples.stream().map(slot3 -> triple(first, second, slot3));
-					}).orElse(empty());
-				}
-				debug("Using wildcard second and third slot values.");
-				return twoTuples
-						.flatten((slot2, oneTuples) -> oneTuples.stream().map(slot3 -> triple(first, slot2, slot3)));
-			}).orElse(empty());
-		}
-		debug("Using a wildcard for all slot values.");
-		return threeTuples.flatten((slot1, twoTuples) -> twoTuples
-				.flatten((slot2, oneTuples) -> oneTuples.stream().map(slot3 -> triple(slot1, slot2, slot3))));
-	}
+        debug("Querying on three-tuple pattern: {} {} {} .", first, second, third);
+        final ThreeTupleMap threeTuples = local().get();
+        if (isConcrete(first)) {
+            debug("Using a specific first slot value.");
+            return (Stream<Triple>) threeTuples.get(first).map(twoTuples -> {
+                if (isConcrete(second)) {
+                    debug("Using a specific second slot value.");
+                    return twoTuples.get(second).map(oneTuples -> {
+                        if (isConcrete(third)) {
+                            debug("Using a specific third slot value.");
+                            return oneTuples.contains(third) ? Stream.of(triple(first, second, third)) : empty();
+                        }
+                        debug("Using a wildcard third slot value.");
+                        return oneTuples.stream().map(slot3 -> triple(first, second, slot3));
+                    }).orElse(empty());
+                }
+                debug("Using wildcard second and third slot values.");
+                return twoTuples
+                    .flatten((slot2, oneTuples) -> oneTuples.stream().map(slot3 -> triple(first, slot2, slot3)));
+            }).orElse(empty());
+        }
+        debug("Using a wildcard for all slot values.");
+        return threeTuples.flatten((slot1, twoTuples) -> twoTuples
+                                   .flatten((slot2, oneTuples) -> oneTuples.stream().map(slot3 -> triple(slot1, slot2, slot3))));
+    }
 
-	/**
-	 * Constructs a {@link Triple} from the nodes given, using the appropriate order for this table. E.g. a POS table
-	 * should return a {@code Triple} using ({@code second}, {@code third}, {@code first}).
-	 *
-	 * @param first
-	 * @param second
-	 * @param third
-	 * @return a {@code Triple}
-	 */
-	protected abstract Triple triple(final Node first, final Node second, final Node third);
+    /**
+     * Constructs a {@link Triple} from the nodes given, using the appropriate order for this table. E.g. a POS table
+     * should return a {@code Triple} using ({@code second}, {@code third}, {@code first}).
+     *
+     * @param first
+     * @param second
+     * @param third
+     * @return a {@code Triple}
+     */
+    protected abstract Triple triple(final Node first, final Node second, final Node third);
 
-	protected void _add(final Node first, final Node second, final Node third) {
-		debug("Adding three-tuple {} {} {}", first, second, third);
-		final ThreeTupleMap threeTuples = local().get();
-		TwoTupleMap twoTuples = threeTuples.get(first).orElse(new TwoTupleMap());
-		PersistentSet<Node> oneTuples = twoTuples.get(second).orElse(PersistentSet.empty());
+    protected void _add(final Node first, final Node second, final Node third) {
+        debug("Adding three-tuple {} {} {}", first, second, third);
+        final ThreeTupleMap threeTuples = local().get();
+        TwoTupleMap twoTuples = threeTuples.get(first).orElse(new TwoTupleMap());
+        PersistentSet<Node> oneTuples = twoTuples.get(second).orElse(PersistentSet.empty());
 
-		oneTuples = oneTuples.plus(third);
-		twoTuples = twoTuples.minus(second).plus(second, oneTuples);
-		local().set(threeTuples.minus(first).plus(first, twoTuples));
-	}
+        oneTuples = oneTuples.plus(third);
+        twoTuples = twoTuples.minus(second).plus(second, oneTuples);
+        local().set(threeTuples.minus(first).plus(first, twoTuples));
+    }
 
-	protected void _delete(final Node first, final Node second, final Node third) {
-		debug("Deleting three-tuple {} {} {}", first, second, third);
-		final ThreeTupleMap threeTuples = local().get();
-		threeTuples.get(first).ifPresent(twoTuples -> twoTuples.get(second).ifPresent(oneTuples -> {
-			if (oneTuples.contains(third)) {
-				final TwoTupleMap newTwoTuples = twoTuples.minus(second).plus(second, oneTuples.minus(third));
-				debug("Setting transactional index to new value.");
-				local().set(threeTuples.minus(first).plus(first, newTwoTuples));
-			}
-		}));
-	}
+    protected void _delete(final Node first, final Node second, final Node third) {
+        debug("Deleting three-tuple {} {} {}", first, second, third);
+        final ThreeTupleMap threeTuples = local().get();
+        threeTuples.get(first).ifPresent(twoTuples -> twoTuples.get(second).ifPresent(oneTuples -> {
+            if (oneTuples.contains(third)) {
+                final TwoTupleMap newTwoTuples = twoTuples.minus(second).plus(second, oneTuples.minus(third));
+                debug("Setting transactional index to new value.");
+                local().set(threeTuples.minus(first).plus(first, newTwoTuples));
+            }
+        }));
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTupleTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTupleTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTupleTable.java
index b2ed80d..e70b0a0 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTupleTable.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTupleTable.java
@@ -34,88 +34,88 @@ import org.slf4j.Logger;
  */
 public abstract class PMapTupleTable<TupleMapType, TupleType> implements TupleTable<TupleType> {
 
-	/**
-	 * This method should always return the same value, but note that the same value may not necessarily be the same
-	 * instance.
-	 *
-	 * @return a value to which to initialize the master table data.
-	 */
-	protected abstract TupleMapType initial();
-
-	private final AtomicReference<TupleMapType> master = new AtomicReference<>(initial());
-
-	/**
-	 * We use an {@link AtomicReference} to the internal structure that holds our table data to be able to swap
-	 * transactional versions of the data with the shared version atomically.
-	 */
-	protected AtomicReference<TupleMapType> master() {
-		return master;
-	}
-
-	private final ThreadLocal<TupleMapType> local = withInitial(() -> master().get());
-
-	/**
-	 * @return a thread-local transactional reference to the internal table structure
-	 */
-	protected ThreadLocal<TupleMapType> local() {
-		return local;
-	}
-
-	private final ThreadLocal<Boolean> isInTransaction = withInitial(() -> false);
-
-	@Override
-	public boolean isInTransaction() {
-		return isInTransaction.get();
-	}
-
-	protected void isInTransaction(final boolean b) {
-		isInTransaction.set(b);
-	}
-
-	private final String tableName;
-
-	/**
-	 * @param n a name for this table
-	 */
-	public PMapTupleTable(final String n) {
-		this.tableName = n;
-	}
-
-	protected abstract Logger log();
-
-	/**
-	 * Logs to DEBUG prepending the table name in order to distinguish amongst different indexes
-	 */
-	protected void debug(final String msg, final Object... values) {
-	    if ( log().isDebugEnabled() )
-	        log().debug(tableName + ": " + msg, values);
-	}
-
-	@Override
-	public void begin(final ReadWrite rw) {
-		isInTransaction(true);
-	}
-
-	@Override
-	public void end() {
-		debug("Abandoning transactional reference.");
-		local.remove();
-		isInTransaction.remove();
-	}
-
-	@Override
-	public void commit() {
-		debug("Swapping transactional reference in for shared reference");
-		master().set(local.get());
-		end();
-	}
-
-	@Override
-	public void clear() {
-		local().set(initial());
-	}
-
-	protected boolean isConcrete(final Node n) {
-		return n != null && n.isConcrete();
-	}
+    /**
+     * This method should always return the same value, but note that the same value may not necessarily be the same
+     * instance.
+     *
+     * @return a value to which to initialize the master table data.
+     */
+    protected abstract TupleMapType initial();
+
+    private final AtomicReference<TupleMapType> master = new AtomicReference<>(initial());
+
+    /**
+     * We use an {@link AtomicReference} to the internal structure that holds our table data to be able to swap
+     * transactional versions of the data with the shared version atomically.
+     */
+    protected AtomicReference<TupleMapType> master() {
+        return master;
+    }
+
+    private final ThreadLocal<TupleMapType> local = withInitial(() -> master().get());
+
+    /**
+     * @return a thread-local transactional reference to the internal table structure
+     */
+    protected ThreadLocal<TupleMapType> local() {
+        return local;
+    }
+
+    private final ThreadLocal<Boolean> isInTransaction = withInitial(() -> false);
+
+    @Override
+    public boolean isInTransaction() {
+        return isInTransaction.get();
+    }
+
+    protected void isInTransaction(final boolean b) {
+        isInTransaction.set(b);
+    }
+
+    private final String tableName;
+
+    /**
+     * @param n a name for this table
+     */
+    public PMapTupleTable(final String n) {
+        this.tableName = n;
+    }
+
+    protected abstract Logger log();
+
+    /**
+     * Logs to DEBUG prepending the table name in order to distinguish amongst different indexes
+     */
+    protected void debug(final String msg, final Object... values) {
+        if ( log().isDebugEnabled() )
+            log().debug(tableName + ": " + msg, values);
+    }
+
+    @Override
+    public void begin(final ReadWrite rw) {
+        isInTransaction(true);
+    }
+
+    @Override
+    public void end() {
+        debug("Abandoning transactional reference.");
+        local.remove();
+        isInTransaction.remove();
+    }
+
+    @Override
+    public void commit() {
+        debug("Swapping transactional reference in for shared reference");
+        master().set(local.get());
+        end();
+    }
+
+    @Override
+    public void clear() {
+        local().set(initial());
+    }
+
+    protected boolean isConcrete(final Node n) {
+        return n != null && n.isConcrete();
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/QuadTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/QuadTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/QuadTable.java
index 579c1e2..c4fb521 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/QuadTable.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/QuadTable.java
@@ -35,37 +35,37 @@ import org.apache.jena.sparql.core.Quad;
  */
 public interface QuadTable extends TupleTable<Quad> {
 
-	/**
-	 * Search the table using a pattern of slots. {@link Node#ANY} or <code>null</code> will work as a wildcard.
-	 *
-	 * @param g the graph node of the pattern
-	 * @param s the subject node of the pattern
-	 * @param p the predicate node of the pattern
-	 * @param o the object node of the pattern
-	 * @return an {@link Stream} of matched quads
-	 */
-	Stream<Quad> find(Node g, Node s, Node p, Node o);
+    /**
+     * Search the table using a pattern of slots. {@link Node#ANY} or <code>null</code> will work as a wildcard.
+     *
+     * @param g the graph node of the pattern
+     * @param s the subject node of the pattern
+     * @param p the predicate node of the pattern
+     * @param o the object node of the pattern
+     * @return an {@link Stream} of matched quads
+     */
+    Stream<Quad> find(Node g, Node s, Node p, Node o);
 
-	/**
-	 * Discover the graphs named in the table
-	 *
-	 * @return an {@link Stream} of graph names used in this table
-	 */
-	default Stream<Node> listGraphNodes() {
-		return find(ANY, ANY, ANY, ANY).map(Quad::getGraph).distinct();
-	}
+    /**
+     * Discover the graphs named in the table
+     *
+     * @return an {@link Stream} of graph names used in this table
+     */
+    default Stream<Node> listGraphNodes() {
+        return find(ANY, ANY, ANY, ANY).map(Quad::getGraph).distinct();
+    }
 
-	@Override
-	default void clear() {
-		find(ANY, ANY, ANY, ANY).forEach(this::delete);
-	}
+    @Override
+    default void clear() {
+        find(ANY, ANY, ANY, ANY).forEach(this::delete);
+    }
 
-	default Stream<Quad> findInUnionGraph(final Node s, final Node p, final Node o) {
-		final Set<Triple> seen = new HashSet<>();
-		return find(ANY, s, p, o).sequential()
-		    .filter(q -> !q.isDefaultGraph())
-		    .map(Quad::asTriple)
-		    .filter(seen::add)
-		    .map(t -> Quad.create(Quad.unionGraph, t)) ;
-	}
+    default Stream<Quad> findInUnionGraph(final Node s, final Node p, final Node o) {
+        final Set<Triple> seen = new HashSet<>();
+        return find(ANY, s, p, o).sequential()
+            .filter(q -> !q.isDefaultGraph())
+            .map(Quad::asTriple)
+            .filter(seen::add)
+            .map(t -> Quad.create(Quad.unionGraph, t)) ;
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/QuadTableForm.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/QuadTableForm.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/QuadTableForm.java
index 3b0d36c..5bc09e6 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/QuadTableForm.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/QuadTableForm.java
@@ -47,250 +47,250 @@ import org.apache.jena.sparql.core.Quad;
  */
 public enum QuadTableForm implements Supplier<QuadTable>,Predicate<Set<TupleSlot>> {
 
-	/**
-	 * Graph-subject-predicate-object.
-	 */
-	GSPO(asList(GRAPH, SUBJECT, PREDICATE, OBJECT)) {
-		@Override
-		public PMapQuadTable get() {
-			return new PMapQuadTable(name()) {
-
-				@Override
-				protected Quad quad(final Node g, final Node s, final Node p, final Node o) {
-					return Quad.create(g, s, p, o);
-				}
-
-				@Override
-				public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
-					return _find(g, s, p, o);
-				}
-
-				@Override
-				public void add(final Quad q) {
-					_add(q.getGraph(), q.getSubject(), q.getPredicate(), q.getObject());
-				}
-
-				@Override
-				public void delete(final Quad q) {
-					_delete(q.getGraph(), q.getSubject(), q.getPredicate(), q.getObject());
-				}
-
-				@Override
-				public Stream<Node> listGraphNodes() {
-					return local().get().entryStream().map(Entry::getKey);
-				}
-			};
-		}
-	},
-
-	/**
-	 * Graph-object-predicate-subject.
-	 */
-	GOPS(asList(GRAPH, OBJECT, PREDICATE, SUBJECT)) {
-		@Override
-		public PMapQuadTable get() {
-			return new PMapQuadTable(name()) {
-
-				@Override
-				protected Quad quad(final Node g, final Node o, final Node p, final Node s) {
-					return Quad.create(g, s, p, o);
-				}
-
-				@Override
-				public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
-					return _find(g, o, p, s);
-				}
-
-				@Override
-				public void add(final Quad q) {
-					_add(q.getGraph(), q.getObject(), q.getPredicate(), q.getSubject());
-				}
-
-				@Override
-				public void delete(final Quad q) {
-					_delete(q.getGraph(), q.getObject(), q.getPredicate(), q.getSubject());
-				}
-			};
-
-		}
-	},
-
-	/**
-	 * Subject-predicate-object-graph.
-	 */
-	SPOG(asList(SUBJECT, PREDICATE, OBJECT, GRAPH)) {
-		@Override
-		public PMapQuadTable get() {
-			return new PMapQuadTable(name()) {
-
-				@Override
-				protected Quad quad(final Node s, final Node p, final Node o, final Node g) {
-					return Quad.create(g, s, p, o);
-				}
-
-				@Override
-				public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
-					return _find(s, p, o, g);
-				}
-
-				@Override
-				public Stream<Quad> findInUnionGraph(final Node s, final Node p, final Node o) {
-				    final AtomicReference<Triple> mostRecentlySeen = new AtomicReference<>();
-				    return find(ANY, s, p, o).map(Quad::asTriple).filter(t->{
-				        return !mostRecentlySeen.getAndSet(t).equals(t);
-				    }).map(t->Quad.create(Quad.unionGraph, t)) ;
-				}
-
-				@Override
-				public void add(final Quad q) {
-					_add(q.getSubject(), q.getPredicate(), q.getObject(), q.getGraph());
-				}
-
-				@Override
-				public void delete(final Quad q) {
-					_delete(q.getSubject(), q.getPredicate(), q.getObject(), q.getGraph());
-				}
-			};
-		}
-	},
-
-	/**
-	 * Object-subject-graph-predicate.
-	 */
-	OSGP(asList(OBJECT, SUBJECT, GRAPH, PREDICATE)) {
-		@Override
-		public PMapQuadTable get() {
-			return new PMapQuadTable(name()) {
-
-				@Override
-				protected Quad quad(final Node o, final Node s, final Node g, final Node p) {
-					return Quad.create(g, s, p, o);
-				}
-
-				@Override
-				public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
-					return _find(o, s, g, p);
-				}
-
-				@Override
-				public void add(final Quad q) {
-					_add(q.getObject(), q.getSubject(), q.getGraph(), q.getPredicate());
-				}
-
-				@Override
-				public void delete(final Quad q) {
-					_delete(q.getObject(), q.getSubject(), q.getGraph(), q.getPredicate());
-				}
-			};
-		}
-	},
-
-	/**
-	 * Predicate-graph-subject-object.
-	 */
-	PGSO(asList(PREDICATE, GRAPH, SUBJECT, OBJECT)) {
-		@Override
-		public PMapQuadTable get() {
-			return new PMapQuadTable(name()) {
-
-				@Override
-				protected Quad quad(final Node p, final Node g, final Node s, final Node o) {
-					return Quad.create(g, s, p, o);
-				}
-
-				@Override
-				public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
-					return _find(p, g, s, o);
-				}
-
-				@Override
-				public void add(final Quad q) {
-					_add(q.getPredicate(), q.getGraph(), q.getSubject(), q.getObject());
-				}
-
-				@Override
-				public void delete(final Quad q) {
-					_delete(q.getPredicate(), q.getGraph(), q.getSubject(), q.getObject());
-				}
-			};
-		}
-	},
-
-	/**
-	 * Object-predicate-subject-graph.
-	 */
-	OPSG(asList(OBJECT, PREDICATE, SUBJECT, GRAPH)) {
-		@Override
-		public PMapQuadTable get() {
-			return new PMapQuadTable(name()) {
-
-				@Override
-				protected Quad quad(final Node o, final Node p, final Node s, final Node g) {
-					return Quad.create(g, s, p, o);
-				}
-
-				@Override
-				public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
-					return _find(o, p, s, g);
-				}
-
-				@Override
-				public Stream<Quad> findInUnionGraph(final Node s, final Node p, final Node o) {
-					final AtomicReference<Triple> mostRecentlySeen = new AtomicReference<>();
-					return find(ANY, s, p, o).map(Quad::asTriple).filter(t->{
-						return !mostRecentlySeen.getAndSet(t).equals(t);
-					}).map(t->Quad.create(Quad.unionGraph, t)) ;
-				}
-
-				@Override
-				public void add(final Quad q) {
-					_add(q.getObject(), q.getPredicate(), q.getSubject(), q.getGraph());
-				}
-
-				@Override
-				public void delete(final Quad q) {
-					_delete(q.getObject(), q.getPredicate(), q.getSubject(), q.getGraph());
-				}
-			};
-		}
-	};
-
-	private QuadTableForm(final List<TupleSlot> fp) {
-		this.fullpattern = fp;
-	}
-
-	/**
-	 * The full pattern of this table form.
-	 */
-	public final List<TupleSlot> fullpattern;
-
-	/**
-	 * @param pattern
-	 * @return whether this table form avoids traversal for a query of this pattern
-	 */
-	@Override
-	public boolean test(final Set<TupleSlot> pattern) {
-		for (byte i = 4; i > 0; i--) {
-			// copy into a set because order does not matter for this comparison: the ordering of tuples is
-			// handled by individual table forms
-			final Set<TupleSlot> prefix = copyOf(fullpattern.subList(0, i));
-			if (prefix.equals(pattern)) return true;
-		}
-		return false;
-	}
-
-	/**
-	 * @param pattern
-	 * @return the most appropriate choice of table form for that query
-	 */
-	public static QuadTableForm chooseFrom(final Set<TupleSlot> pattern) {
-		return tableForms().filter(f -> f.test(pattern)).findFirst().orElse(GSPO);
-	}
-
-	/**
-	 * @return a stream of these table forms
-	 */
-	public static Stream<QuadTableForm> tableForms() {
-		return stream(values());
-	}
+    /**
+     * Graph-subject-predicate-object.
+     */
+    GSPO(asList(GRAPH, SUBJECT, PREDICATE, OBJECT)) {
+        @Override
+        public PMapQuadTable get() {
+            return new PMapQuadTable(name()) {
+
+                @Override
+                protected Quad quad(final Node g, final Node s, final Node p, final Node o) {
+                    return Quad.create(g, s, p, o);
+                }
+
+                @Override
+                public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
+                    return _find(g, s, p, o);
+                }
+
+                @Override
+                public void add(final Quad q) {
+                    _add(q.getGraph(), q.getSubject(), q.getPredicate(), q.getObject());
+                }
+
+                @Override
+                public void delete(final Quad q) {
+                    _delete(q.getGraph(), q.getSubject(), q.getPredicate(), q.getObject());
+                }
+
+                @Override
+                public Stream<Node> listGraphNodes() {
+                    return local().get().entryStream().map(Entry::getKey);
+                }
+            };
+        }
+    },
+
+    /**
+     * Graph-object-predicate-subject.
+     */
+    GOPS(asList(GRAPH, OBJECT, PREDICATE, SUBJECT)) {
+        @Override
+        public PMapQuadTable get() {
+            return new PMapQuadTable(name()) {
+
+                @Override
+                protected Quad quad(final Node g, final Node o, final Node p, final Node s) {
+                    return Quad.create(g, s, p, o);
+                }
+
+                @Override
+                public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
+                    return _find(g, o, p, s);
+                }
+
+                @Override
+                public void add(final Quad q) {
+                    _add(q.getGraph(), q.getObject(), q.getPredicate(), q.getSubject());
+                }
+
+                @Override
+                public void delete(final Quad q) {
+                    _delete(q.getGraph(), q.getObject(), q.getPredicate(), q.getSubject());
+                }
+            };
+
+        }
+    },
+
+    /**
+     * Subject-predicate-object-graph.
+     */
+    SPOG(asList(SUBJECT, PREDICATE, OBJECT, GRAPH)) {
+        @Override
+        public PMapQuadTable get() {
+            return new PMapQuadTable(name()) {
+
+                @Override
+                protected Quad quad(final Node s, final Node p, final Node o, final Node g) {
+                    return Quad.create(g, s, p, o);
+                }
+
+                @Override
+                public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
+                    return _find(s, p, o, g);
+                }
+
+                @Override
+                public Stream<Quad> findInUnionGraph(final Node s, final Node p, final Node o) {
+                    final AtomicReference<Triple> mostRecentlySeen = new AtomicReference<>();
+                    return find(ANY, s, p, o).map(Quad::asTriple).filter(t->{
+                        return !mostRecentlySeen.getAndSet(t).equals(t);
+                    }).map(t->Quad.create(Quad.unionGraph, t)) ;
+                }
+
+                @Override
+                public void add(final Quad q) {
+                    _add(q.getSubject(), q.getPredicate(), q.getObject(), q.getGraph());
+                }
+
+                @Override
+                public void delete(final Quad q) {
+                    _delete(q.getSubject(), q.getPredicate(), q.getObject(), q.getGraph());
+                }
+            };
+        }
+    },
+
+    /**
+     * Object-subject-graph-predicate.
+     */
+    OSGP(asList(OBJECT, SUBJECT, GRAPH, PREDICATE)) {
+        @Override
+        public PMapQuadTable get() {
+            return new PMapQuadTable(name()) {
+
+                @Override
+                protected Quad quad(final Node o, final Node s, final Node g, final Node p) {
+                    return Quad.create(g, s, p, o);
+                }
+
+                @Override
+                public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
+                    return _find(o, s, g, p);
+                }
+
+                @Override
+                public void add(final Quad q) {
+                    _add(q.getObject(), q.getSubject(), q.getGraph(), q.getPredicate());
+                }
+
+                @Override
+                public void delete(final Quad q) {
+                    _delete(q.getObject(), q.getSubject(), q.getGraph(), q.getPredicate());
+                }
+            };
+        }
+    },
+
+    /**
+     * Predicate-graph-subject-object.
+     */
+    PGSO(asList(PREDICATE, GRAPH, SUBJECT, OBJECT)) {
+        @Override
+        public PMapQuadTable get() {
+            return new PMapQuadTable(name()) {
+
+                @Override
+                protected Quad quad(final Node p, final Node g, final Node s, final Node o) {
+                    return Quad.create(g, s, p, o);
+                }
+
+                @Override
+                public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
+                    return _find(p, g, s, o);
+                }
+
+                @Override
+                public void add(final Quad q) {
+                    _add(q.getPredicate(), q.getGraph(), q.getSubject(), q.getObject());
+                }
+
+                @Override
+                public void delete(final Quad q) {
+                    _delete(q.getPredicate(), q.getGraph(), q.getSubject(), q.getObject());
+                }
+            };
+        }
+    },
+
+    /**
+     * Object-predicate-subject-graph.
+     */
+    OPSG(asList(OBJECT, PREDICATE, SUBJECT, GRAPH)) {
+        @Override
+        public PMapQuadTable get() {
+            return new PMapQuadTable(name()) {
+
+                @Override
+                protected Quad quad(final Node o, final Node p, final Node s, final Node g) {
+                    return Quad.create(g, s, p, o);
+                }
+
+                @Override
+                public Stream<Quad> find(final Node g, final Node s, final Node p, final Node o) {
+                    return _find(o, p, s, g);
+                }
+
+                @Override
+                public Stream<Quad> findInUnionGraph(final Node s, final Node p, final Node o) {
+                    final AtomicReference<Triple> mostRecentlySeen = new AtomicReference<>();
+                    return find(ANY, s, p, o).map(Quad::asTriple).filter(t->{
+                        return !mostRecentlySeen.getAndSet(t).equals(t);
+                    }).map(t->Quad.create(Quad.unionGraph, t)) ;
+                }
+
+                @Override
+                public void add(final Quad q) {
+                    _add(q.getObject(), q.getPredicate(), q.getSubject(), q.getGraph());
+                }
+
+                @Override
+                public void delete(final Quad q) {
+                    _delete(q.getObject(), q.getPredicate(), q.getSubject(), q.getGraph());
+                }
+            };
+        }
+    };
+
+    private QuadTableForm(final List<TupleSlot> fp) {
+        this.fullpattern = fp;
+    }
+
+    /**
+     * The full pattern of this table form.
+     */
+    public final List<TupleSlot> fullpattern;
+
+    /**
+     * @param pattern
+     * @return whether this table form avoids traversal for a query of this pattern
+     */
+    @Override
+    public boolean test(final Set<TupleSlot> pattern) {
+        for (byte i = 4; i > 0; i--) {
+            // copy into a set because order does not matter for this comparison: the ordering of tuples is
+            // handled by individual table forms
+            final Set<TupleSlot> prefix = copyOf(fullpattern.subList(0, i));
+            if (prefix.equals(pattern)) return true;
+        }
+        return false;
+    }
+
+    /**
+     * @param pattern
+     * @return the most appropriate choice of table form for that query
+     */
+    public static QuadTableForm chooseFrom(final Set<TupleSlot> pattern) {
+        return tableForms().filter(f -> f.test(pattern)).findFirst().orElse(GSPO);
+    }
+
+    /**
+     * @return a stream of these table forms
+     */
+    public static Stream<QuadTableForm> tableForms() {
+        return stream(values());
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TriTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TriTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TriTable.java
index 9bd4ac9..e5ad562 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TriTable.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TriTable.java
@@ -41,77 +41,77 @@ import org.apache.jena.query.ReadWrite;
  */
 public class TriTable implements TripleTable {
 
-	private final Map<TripleTableForm, TripleTable> indexBlock = new EnumMap<TripleTableForm, TripleTable>(
-			tableForms().collect(toMap(x -> x, TripleTableForm::get)));
-
-	/**
-	 * A block of three indexes to which we provide access as though they were one.
-	 */
-	protected Map<TripleTableForm, TripleTable> indexBlock() {
-		return indexBlock;
-	}
-
-	private final ThreadLocal<Boolean> isInTransaction = withInitial(() -> false);
-
-	@Override
-	public boolean isInTransaction() {
-		return isInTransaction.get();
-	}
-
-	protected void isInTransaction(final boolean b) {
-		isInTransaction.set(b);
-	}
-
-	@Override
-	public void commit() {
-		indexBlock().values().forEach(TripleTable::commit);
-		end();
-	}
-
-	@Override
-	public void abort() {
-		indexBlock().values().forEach(TripleTable::abort);
-		end();
-	}
-
-	@Override
-	public void end() {
-		indexBlock().values().forEach(TripleTable::end);
-		isInTransaction.remove();
-	}
-
-	@Override
-	public Stream<Triple> find(final Node s, final Node p, final Node o) {
-		final Set<TupleSlot> pattern = noneOf(TupleSlot.class);
-		if (isConcrete(s)) pattern.add(SUBJECT);
-		if (isConcrete(p)) pattern.add(PREDICATE);
-		if (isConcrete(o)) pattern.add(OBJECT);
-		final TripleTableForm choice = chooseFrom(pattern);
-		return indexBlock().get(choice).find(s, p, o);
-	}
-
-	private static boolean isConcrete(final Node n) {
-		return nonNull(n) && n.isConcrete();
-	}
-
-	@Override
-	public void add(final Triple t) {
-		indexBlock().values().forEach(index -> index.add(t));
-	}
-
-	@Override
-	public void delete(final Triple t) {
-		indexBlock().values().forEach(index -> index.delete(t));
-	}
-
-	@Override
-	public void begin(final ReadWrite rw) {
-		isInTransaction(true);
-		indexBlock().values().forEach(table -> table.begin(rw));
-	}
-
-	@Override
-	public void clear() {
-		indexBlock().values().forEach(TripleTable::clear);
-	}
+    private final Map<TripleTableForm, TripleTable> indexBlock = new EnumMap<TripleTableForm, TripleTable>(
+        tableForms().collect(toMap(x -> x, TripleTableForm::get)));
+
+    /**
+     * A block of three indexes to which we provide access as though they were one.
+     */
+    protected Map<TripleTableForm, TripleTable> indexBlock() {
+        return indexBlock;
+    }
+
+    private final ThreadLocal<Boolean> isInTransaction = withInitial(() -> false);
+
+    @Override
+    public boolean isInTransaction() {
+        return isInTransaction.get();
+    }
+
+    protected void isInTransaction(final boolean b) {
+        isInTransaction.set(b);
+    }
+
+    @Override
+    public void commit() {
+        indexBlock().values().forEach(TripleTable::commit);
+        end();
+    }
+
+    @Override
+    public void abort() {
+        indexBlock().values().forEach(TripleTable::abort);
+        end();
+    }
+
+    @Override
+    public void end() {
+        indexBlock().values().forEach(TripleTable::end);
+        isInTransaction.remove();
+    }
+
+    @Override
+    public Stream<Triple> find(final Node s, final Node p, final Node o) {
+        final Set<TupleSlot> pattern = noneOf(TupleSlot.class);
+        if (isConcrete(s)) pattern.add(SUBJECT);
+        if (isConcrete(p)) pattern.add(PREDICATE);
+        if (isConcrete(o)) pattern.add(OBJECT);
+        final TripleTableForm choice = chooseFrom(pattern);
+        return indexBlock().get(choice).find(s, p, o);
+    }
+
+    private static boolean isConcrete(final Node n) {
+        return nonNull(n) && n.isConcrete();
+    }
+
+    @Override
+    public void add(final Triple t) {
+        indexBlock().values().forEach(index -> index.add(t));
+    }
+
+    @Override
+    public void delete(final Triple t) {
+        indexBlock().values().forEach(index -> index.delete(t));
+    }
+
+    @Override
+    public void begin(final ReadWrite rw) {
+        isInTransaction(true);
+        indexBlock().values().forEach(table -> table.begin(rw));
+    }
+
+    @Override
+    public void clear() {
+        indexBlock().values().forEach(TripleTable::clear);
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TripleTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TripleTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TripleTable.java
index a748b25..0a3c354 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TripleTable.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TripleTable.java
@@ -29,18 +29,18 @@ import org.apache.jena.graph.Triple;
  */
 public interface TripleTable extends TupleTable<Triple> {
 
-	/**
-	 * Search the table using a pattern of slots. {@link Node#ANY} or <code>null</code> will work as a wildcard.
-	 *
-	 * @param s the subject node of the pattern
-	 * @param p the predicate node of the pattern
-	 * @param o the object node of the pattern
-	 * @return an {@link Stream} of matched triples
-	 */
-	Stream<Triple> find(Node s, Node p, Node o);
+    /**
+     * Search the table using a pattern of slots. {@link Node#ANY} or <code>null</code> will work as a wildcard.
+     *
+     * @param s the subject node of the pattern
+     * @param p the predicate node of the pattern
+     * @param o the object node of the pattern
+     * @return an {@link Stream} of matched triples
+     */
+    Stream<Triple> find(Node s, Node p, Node o);
 
-	@Override
-	default void clear() {
-		find(null, null, null).forEach(this::delete);
-	}
+    @Override
+    default void clear() {
+        find(null, null, null).forEach(this::delete);
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TripleTableForm.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TripleTableForm.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TripleTableForm.java
index b92af17..822ff8c 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TripleTableForm.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TripleTableForm.java
@@ -36,133 +36,133 @@ import org.apache.jena.graph.Triple;
  */
 public enum TripleTableForm implements Supplier<TripleTable>,Predicate<Set<TupleSlot>> {
 
-	/**
-	 * Subject-predicate-object.
-	 */
-	SPO(of(SUBJECT, PREDICATE), SUBJECT) {
-		@Override
-		public TripleTable get() {
-			return new PMapTripleTable(name()) {
-
-				@Override
-				protected Triple triple(final Node s, final Node p, final Node o) {
-					return Triple.create(s, p, o);
-				}
-
-				@Override
-				public Stream<Triple> find(final Node s, final Node p, final Node o) {
-					return _find(s, p, o);
-				}
-
-				@Override
-				public void add(final Triple t) {
-					_add(t.getSubject(), t.getPredicate(), t.getObject());
-				}
-
-				@Override
-				public void delete(final Triple t) {
-					_delete(t.getSubject(), t.getPredicate(), t.getObject());
-				}
-
-			};
-		}
-
-	},
-	/**
-	 * Predicate-object-subject.
-	 */
-	POS(of(PREDICATE, OBJECT), PREDICATE) {
-
-		@Override
-		public TripleTable get() {
-			return new PMapTripleTable(name()) {
-
-				@Override
-				protected Triple triple(final Node p, final Node o, final Node s) {
-					return Triple.create(s, p, o);
-				}
-
-				@Override
-				public Stream<Triple> find(final Node s, final Node p, final Node o) {
-					return _find(p, o, s);
-				}
-
-				@Override
-				public void add(final Triple t) {
-					_add(t.getPredicate(), t.getObject(), t.getSubject());
-				}
-
-				@Override
-				public void delete(final Triple t) {
-					_delete(t.getPredicate(), t.getObject(), t.getSubject());
-				}
-
-			};
-		}
-	},
-	/**
-	 * Object-subject-predicate.
-	 */
-	OSP(of(OBJECT, SUBJECT), OBJECT) {
-
-		@Override
-		public TripleTable get() {
-			return new PMapTripleTable(name()) {
-
-				@Override
-				protected Triple triple(final Node o, final Node s, final Node p) {
-					return Triple.create(s, p, o);
-				}
-
-				@Override
-				public Stream<Triple> find(final Node s, final Node p, final Node o) {
-					return _find(o, s, p);
-				}
-
-				@Override
-				public void add(final Triple t) {
-					_add(t.getObject(), t.getSubject(), t.getPredicate());
-				}
-
-				@Override
-				public void delete(final Triple t) {
-					_delete(t.getObject(), t.getSubject(), t.getPredicate());
-				}
-
-			};
-		}
-	};
-	private TripleTableForm(final Set<TupleSlot> tp, final TupleSlot op) {
-		this.twoPrefix = tp;
-		this.onePrefix = of(op);
-	}
-
-	/**
-	 * Prefixes of the pattern for this table form.
-	 */
-	public final Set<TupleSlot> twoPrefix, onePrefix;
-
-	/**
-	 * @param pattern
-	 * @return whether this index form avoids traversal for a query of this pattern
-	 */
-	@Override
-	public boolean test(final Set<TupleSlot> pattern) {
-		return twoPrefix.equals(pattern) || onePrefix.equals(pattern) || pattern.size() == 3;
-	}
-
-	/**
-	 * @param pattern
-	 * @return the most appropriate choice of index form for that query
-	 */
-	public static TripleTableForm chooseFrom(final Set<TupleSlot> pattern) {
-		return tableForms().filter(f -> f.test(pattern)).findFirst().orElse(SPO);
-	}
-
-	/**
-	 * @return a stream of these table forms
-	 */
-	public static Stream<TripleTableForm> tableForms() {
-		return stream(values());
-	}
+    /**
+     * Subject-predicate-object.
+     */
+    SPO(of(SUBJECT, PREDICATE), SUBJECT) {
+        @Override
+        public TripleTable get() {
+            return new PMapTripleTable(name()) {
+
+                @Override
+                protected Triple triple(final Node s, final Node p, final Node o) {
+                    return Triple.create(s, p, o);
+                }
+
+                @Override
+                public Stream<Triple> find(final Node s, final Node p, final Node o) {
+                    return _find(s, p, o);
+                }
+
+                @Override
+                public void add(final Triple t) {
+                    _add(t.getSubject(), t.getPredicate(), t.getObject());
+                }
+
+                @Override
+                public void delete(final Triple t) {
+                    _delete(t.getSubject(), t.getPredicate(), t.getObject());
+                }
+
+            };
+        }
+
+    },
+    /**
+     * Predicate-object-subject.
+     */
+    POS(of(PREDICATE, OBJECT), PREDICATE) {
+
+        @Override
+        public TripleTable get() {
+            return new PMapTripleTable(name()) {
+
+                @Override
+                protected Triple triple(final Node p, final Node o, final Node s) {
+                    return Triple.create(s, p, o);
+                }
+
+                @Override
+                public Stream<Triple> find(final Node s, final Node p, final Node o) {
+                    return _find(p, o, s);
+                }
+
+                @Override
+                public void add(final Triple t) {
+                    _add(t.getPredicate(), t.getObject(), t.getSubject());
+                }
+
+                @Override
+                public void delete(final Triple t) {
+                    _delete(t.getPredicate(), t.getObject(), t.getSubject());
+                }
+
+            };
+        }
+    },
+    /**
+     * Object-subject-predicate.
+     */
+    OSP(of(OBJECT, SUBJECT), OBJECT) {
+
+        @Override
+        public TripleTable get() {
+            return new PMapTripleTable(name()) {
+
+                @Override
+                protected Triple triple(final Node o, final Node s, final Node p) {
+                    return Triple.create(s, p, o);
+                }
+
+                @Override
+                public Stream<Triple> find(final Node s, final Node p, final Node o) {
+                    return _find(o, s, p);
+                }
+
+                @Override
+                public void add(final Triple t) {
+                    _add(t.getObject(), t.getSubject(), t.getPredicate());
+                }
+
+                @Override
+                public void delete(final Triple t) {
+                    _delete(t.getObject(), t.getSubject(), t.getPredicate());
+                }
+
+            };
+        }
+    };
+    private TripleTableForm(final Set<TupleSlot> tp, final TupleSlot op) {
+        this.twoPrefix = tp;
+        this.onePrefix = of(op);
+    }
+
+    /**
+     * Prefixes of the pattern for this table form.
+     */
+    public final Set<TupleSlot> twoPrefix, onePrefix;
+
+    /**
+     * @param pattern
+     * @return whether this index form avoids traversal for a query of this pattern
+     */
+    @Override
+    public boolean test(final Set<TupleSlot> pattern) {
+        return twoPrefix.equals(pattern) || onePrefix.equals(pattern) || pattern.size() == 3;
+    }
+
+    /**
+     * @param pattern
+     * @return the most appropriate choice of index form for that query
+     */
+    public static TripleTableForm chooseFrom(final Set<TupleSlot> pattern) {
+        return tableForms().filter(f -> f.test(pattern)).findFirst().orElse(SPO);
+    }
+
+    /**
+     * @return a stream of these table forms
+     */
+    public static Stream<TripleTableForm> tableForms() {
+        return stream(values());
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TupleSlot.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TupleSlot.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TupleSlot.java
index d46fdb4..72f26aa 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TupleSlot.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TupleSlot.java
@@ -23,5 +23,5 @@ package org.apache.jena.sparql.core.mem;
  *
  */
 public enum TupleSlot {
-	GRAPH, SUBJECT, PREDICATE, OBJECT;
+    GRAPH, SUBJECT, PREDICATE, OBJECT;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TupleTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TupleTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TupleTable.java
index 444292e..ad22f6c 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TupleTable.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/TupleTable.java
@@ -27,27 +27,27 @@ import org.apache.jena.sparql.core.Transactional;
  */
 public interface TupleTable<TupleType> extends Transactional {
 
-	/**
-	 * Add a tuple to the table
-	 *
-	 * @param t the tuple to add
-	 */
-	void add(TupleType t);
+    /**
+     * Add a tuple to the table
+     *
+     * @param t the tuple to add
+     */
+    void add(TupleType t);
 
-	/**
-	 * Remove a tuple from the table
-	 *
-	 * @param t the tuple to remove
-	 */
-	void delete(TupleType t);
+    /**
+     * Remove a tuple from the table
+     *
+     * @param t the tuple to remove
+     */
+    void delete(TupleType t);
 
-	@Override
-	default void abort() {
-		end();
-	}
+    @Override
+    default void abort() {
+        end();
+    }
 
-	/**
-	 * Clear all tuples from this table.
-	 */
-	void clear();
+    /**
+     * Clear all tuples from this table.
+     */
+    void clear();
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/8f22481f/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/package-info.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/package-info.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/package-info.java
index 7f15577..547d1ad 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/package-info.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/package-info.java
@@ -17,6 +17,6 @@
  */
 
 /**
- * Types to support efficient in-memory dataset operations
+ * In-memory, transactional dataset
  */
 package org.apache.jena.sparql.core.mem;
\ No newline at end of file


Mime
View raw message