You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2016/05/14 17:22:16 UTC

[20/40] jena git commit: Fix line endings

http://git-wip-us.apache.org/repos/asf/jena/blob/d6ae87fd/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImpl.java
----------------------------------------------------------------------
diff --git a/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImpl.java b/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImpl.java
index 622b3f1..45ec40f 100644
--- a/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImpl.java
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImpl.java
@@ -1,352 +1,352 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.propertytable.impl;
-
-import java.util.* ;
-import java.util.Map.Entry;
-
-import org.apache.jena.atlas.iterator.Iter;
-import org.apache.jena.atlas.iterator.IteratorConcat;
-import org.apache.jena.ext.com.google.common.collect.HashMultimap;
-import org.apache.jena.ext.com.google.common.collect.SetMultimap ;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.Triple ;
-import org.apache.jena.propertytable.Column;
-import org.apache.jena.propertytable.PropertyTable;
-import org.apache.jena.propertytable.Row;
-import org.apache.jena.util.iterator.ExtendedIterator ;
-import org.apache.jena.util.iterator.NullIterator ;
-import org.apache.jena.util.iterator.WrappedIterator ;
-
-/**
- * A PropertyTable Implementation using HashMap.
- * It contains PSO and POS indexes.
- * 
- */
-public class PropertyTableHashMapImpl implements PropertyTable {
-
-	private Map<Node, Column> columnIndex; // Maps property Node key to Column
-	private List<Column> columnList; // Stores the list of columns in the table
-	private Map<Node, Row> rowIndex; // Maps the subject Node key to Row.
-	private List<Row> rowList; // Stores the list of rows in the table
-
-	// PSO index
-	// Maps column Node to (subject Node, value) pairs
-	private Map<Node, Map<Node, Node>> valueIndex; 
-	// POS index
-	// Maps column Node to (value, subject Node) pairs
-	private Map<Node, SetMultimap<Node, Node>> valueReverseIndex; 
-
-	PropertyTableHashMapImpl() {
-		columnIndex = new HashMap<Node, Column>();
-		columnList = new ArrayList<Column>();
-		rowIndex = new HashMap<Node, Row>();
-		rowList = new ArrayList<Row>();
-		valueIndex = new HashMap<Node, Map<Node, Node>>();
-		valueReverseIndex = new HashMap<Node, SetMultimap<Node, Node>>();
-	}
-
-	@Override
-	public ExtendedIterator<Triple> getTripleIterator() {
-		
-		// use PSO index to scan all the table (slow)
-		IteratorConcat<Triple> iter = new IteratorConcat<Triple>();
-		for (Column column : getColumns()) {
-			iter.add(getTripleIterator(column));
-		}
-		return WrappedIterator.create(Iter.distinct(iter));
-	}
-
-	@Override
-	public ExtendedIterator<Triple> getTripleIterator(Column column) {
-		
-		// use PSO index directly (fast)
-		
-		if (column == null || column.getColumnKey() == null)
-			throw new NullPointerException("column is null");
-		
-		ArrayList<Triple> triples = new ArrayList<Triple>();
-		Map<Node, Node> values = valueIndex.get(column.getColumnKey());
-
-		for (Entry<Node, Node> entry : values.entrySet()) {
-			Node subject = entry.getKey();
-			Node value = entry.getValue();
-			triples.add(Triple.create(subject, column.getColumnKey(), value));
-		}
-		return WrappedIterator.create(triples.iterator());
-	}
-
-	@Override
-	public ExtendedIterator<Triple> getTripleIterator(Node value) {
-		
-		// use POS index ( O(n), n= column count )
-		
-		if (value == null)
-			throw new NullPointerException("value is null");
-		
-		IteratorConcat<Triple> iter = new IteratorConcat<Triple>();
-		for (Column column : this.getColumns()) {
-			ExtendedIterator<Triple> eIter = getTripleIterator(column,value);
-			iter.add(eIter);
-		}
-		return WrappedIterator.create(Iter.distinct(iter));
-	}
-
-	@Override
-	public ExtendedIterator<Triple> getTripleIterator(Column column, Node value) {
-		
-		// use POS index directly (fast)
-		
-		if (column == null || column.getColumnKey() == null)
-			throw new NullPointerException("column is null");
-		
-		if (value == null)
-			throw new NullPointerException("value is null");
-		
-		
-		Node p = column.getColumnKey();
-		final SetMultimap<Node, Node> valueToSubjectMap = valueReverseIndex.get(p);
-		if ( valueToSubjectMap == null ) 
-		    return NullIterator.instance() ;
-		final Set<Node> subjects = valueToSubjectMap.get(value);
-		ArrayList<Triple> triples = new ArrayList<Triple>();
-		for (Node subject : subjects) {
-		    triples.add(Triple.create(subject, p, value));
-		}
-		return WrappedIterator.create(triples.iterator());
-	}
-
-
-	@Override
-	public ExtendedIterator<Triple> getTripleIterator(Row row) {
-		// use PSO index ( O(n), n= column count )
-		
-		if (row == null || row.getRowKey() == null)
-			throw new NullPointerException("row is null");
-		
-		ArrayList<Triple> triples = new ArrayList<Triple>();
-		for (Column column : getColumns()) {
-			Node value = row.getValue(column);
-			triples.add(Triple.create(row.getRowKey(), column.getColumnKey(), value));
-		}
-		return WrappedIterator.create(triples.iterator());
-	}
-
-	@Override
-	public Collection<Column> getColumns() {
-		return columnList;
-	}
-
-	@Override
-	public Column getColumn(Node p) {
-		if (p == null)
-			throw new NullPointerException("column node is null");
-		return columnIndex.get(p);
-	}
-
-	@Override
-	public Column createColumn(Node p) {
-		if (p == null)
-			throw new NullPointerException("column node is null");
-
-		if (columnIndex.containsKey(p))
-			throw new IllegalArgumentException("column already exists: '"
-					+ p.toString());
-
-		columnIndex.put(p, new ColumnImpl(this, p));
-		columnList.add(columnIndex.get(p));
-		valueIndex.put(p, new HashMap<Node, Node>());
-		valueReverseIndex.put(p, HashMultimap.create());
-		return getColumn(p);
-	}
-
-	@Override
-	public Row getRow(final Node s) {
-		if (s == null)
-			throw new NullPointerException("subject node is null");
-		Row row = rowIndex.get(s);
-		return row;
-
-	}
-	
-	@Override
-	public Row createRow(final Node s){
-		Row row = this.getRow(s);
-		if (row != null)
-			return row;
-
-		row = new InternalRow(s);
-		rowIndex.put(s, row);
-		rowList.add(row);
-
-		return row;
-	}
-	
-	@Override
-	public List<Row> getAllRows() {
-		return rowList;
-	}
-
-	
-	
-	@Override
-	public List<Node> getColumnValues(Column column) {
-		if (column == null || column.getColumnKey() == null)
-			throw new NullPointerException("column is null");
-		
-		Map<Node, Node> values = valueIndex.get(column.getColumnKey());
-
-		List<Node> list = new ArrayList<Node>(values.size());
-		list.addAll(values.values());
-		return list;
-	}
-	
-	@Override
-	public Collection<Row> getMatchingRows(Column column, Node value) {
-		if (column == null || column.getColumnKey() == null)
-			throw new NullPointerException("column is null");
-		
-		if (value == null)
-			throw new NullPointerException("value is null");
-		
-		
-		Node p = column.getColumnKey();
-		final SetMultimap<Node, Node> valueToSubjectMap = valueReverseIndex.get(p);
-		if ( valueToSubjectMap == null )
-		    return Collections.emptyList() ;
-		final Set<Node> subjects = valueToSubjectMap.get(value);
-		if ( subjects == null )
-		    return Collections.emptyList() ;
-		final ArrayList<Row> matchingRows = new ArrayList<Row>();
-		for (Node subject : subjects) {
-		    matchingRows.add(this.getRow(subject));
-		}
-		return matchingRows;
-	}
-
-	private final void setX(final Node s, final Node p, final Node value) {
-		if (p == null)
-			throw new NullPointerException("column Node must not be null.");
-		if (value == null)
-			throw new NullPointerException("value must not be null.");
-
-		Map<Node, Node> subjectToValueMap = valueIndex.get(p);
-		if (!columnIndex.containsKey(p) || subjectToValueMap == null)
-			throw new IllegalArgumentException("column: '" + p
-					+ "' does not yet exist.");
-
-		Node oldValue = subjectToValueMap.get(s);
-		subjectToValueMap.put(s, value);
-		addToReverseMap(p, s, oldValue, value);
-	}
-
-	private void addToReverseMap(final Node p, final Node s, final Node oldValue, final Node value) {
-
-		final SetMultimap<Node, Node> valueToSubjectMap = valueReverseIndex.get(p);
-		if ( valueToSubjectMap == null )
-            return ; 
-		valueToSubjectMap.remove(oldValue, s);
-		valueToSubjectMap.put(value, s);
-	}
-
-	private void unSetX(final Node s, final Node p) {
-
-		final Map<Node, Node> subjectToValueMap = valueIndex.get(p);
-		if (!columnIndex.containsKey(p) || subjectToValueMap == null)
-			throw new IllegalArgumentException("column: '" + p
-					+ "' does not yet exist.");
-
-		final Node value = subjectToValueMap.get(s);
-		if (value == null)
-			return;
-
-		subjectToValueMap.remove(s);
-		removeFromReverseMap(p, s, value);
-	}
-
-	private void removeFromReverseMap(final Node p, final Node s,
-			final Node value) {
-		final SetMultimap<Node, Node> valueTokeysMap = valueReverseIndex.get(p);
-		if ( valueTokeysMap == null )
-		    return ;
-		valueTokeysMap.remove(s, value);
-	}
-
-	private Node getX(final Node s, final Node p) {
-		final Map<Node, Node> subjectToValueMap = valueIndex.get(p);
-		if (!columnIndex.containsKey(p) || subjectToValueMap == null)
-			throw new IllegalArgumentException("column: '" + p
-					+ "' does not yet exist.");
-		return subjectToValueMap.get(s);
-	}
-
-	private final class InternalRow implements Row {
-		private final Node key;
-
-		InternalRow(final Node key) {
-			this.key = key;
-		}
-
-		@Override
-		public void setValue(Column column, Node value) {
-			if (value == null)
-				unSetX(key, column.getColumnKey());
-			else
-				setX(key, column.getColumnKey(), value);
-		}
-
-		@Override
-		public Node getValue(Column column) {
-			return getX(key, column.getColumnKey());
-		}
-		
-		@Override
-		public Node getValue(Node columnKey) {
-			return getX(key, columnKey);
-		}
-
-		@Override
-		public PropertyTable getTable() {
-			return PropertyTableHashMapImpl.this;
-		}
-
-		@Override
-		public Node getRowKey() {
-			return key;
-		}
-
-		@Override
-		public Collection<Column> getColumns() {
-			// TODO Auto-generated method stub
-			return PropertyTableHashMapImpl.this.getColumns();
-		}
-
-		@Override
-		public ExtendedIterator<Triple> getTripleIterator() {
-			ArrayList<Triple> triples = new ArrayList<Triple>();
-			for (Column column : getColumns()) {
-				Node value = this.getValue(column);
-				triples.add(Triple.create(key, column.getColumnKey(), value));
-			}
-			return WrappedIterator.create(triples.iterator());
-		}
-
-	}
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.propertytable.impl;
+
+import java.util.* ;
+import java.util.Map.Entry;
+
+import org.apache.jena.atlas.iterator.Iter;
+import org.apache.jena.atlas.iterator.IteratorConcat;
+import org.apache.jena.ext.com.google.common.collect.HashMultimap;
+import org.apache.jena.ext.com.google.common.collect.SetMultimap ;
+import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.Triple ;
+import org.apache.jena.propertytable.Column;
+import org.apache.jena.propertytable.PropertyTable;
+import org.apache.jena.propertytable.Row;
+import org.apache.jena.util.iterator.ExtendedIterator ;
+import org.apache.jena.util.iterator.NullIterator ;
+import org.apache.jena.util.iterator.WrappedIterator ;
+
+/**
+ * A PropertyTable Implementation using HashMap.
+ * It contains PSO and POS indexes.
+ * 
+ */
+public class PropertyTableHashMapImpl implements PropertyTable {
+
+	private Map<Node, Column> columnIndex; // Maps property Node key to Column
+	private List<Column> columnList; // Stores the list of columns in the table
+	private Map<Node, Row> rowIndex; // Maps the subject Node key to Row.
+	private List<Row> rowList; // Stores the list of rows in the table
+
+	// PSO index
+	// Maps column Node to (subject Node, value) pairs
+	private Map<Node, Map<Node, Node>> valueIndex; 
+	// POS index
+	// Maps column Node to (value, subject Node) pairs
+	private Map<Node, SetMultimap<Node, Node>> valueReverseIndex; 
+
+	PropertyTableHashMapImpl() {
+		columnIndex = new HashMap<Node, Column>();
+		columnList = new ArrayList<Column>();
+		rowIndex = new HashMap<Node, Row>();
+		rowList = new ArrayList<Row>();
+		valueIndex = new HashMap<Node, Map<Node, Node>>();
+		valueReverseIndex = new HashMap<Node, SetMultimap<Node, Node>>();
+	}
+
+	@Override
+	public ExtendedIterator<Triple> getTripleIterator() {
+		
+		// use PSO index to scan all the table (slow)
+		IteratorConcat<Triple> iter = new IteratorConcat<Triple>();
+		for (Column column : getColumns()) {
+			iter.add(getTripleIterator(column));
+		}
+		return WrappedIterator.create(Iter.distinct(iter));
+	}
+
+	@Override
+	public ExtendedIterator<Triple> getTripleIterator(Column column) {
+		
+		// use PSO index directly (fast)
+		
+		if (column == null || column.getColumnKey() == null)
+			throw new NullPointerException("column is null");
+		
+		ArrayList<Triple> triples = new ArrayList<Triple>();
+		Map<Node, Node> values = valueIndex.get(column.getColumnKey());
+
+		for (Entry<Node, Node> entry : values.entrySet()) {
+			Node subject = entry.getKey();
+			Node value = entry.getValue();
+			triples.add(Triple.create(subject, column.getColumnKey(), value));
+		}
+		return WrappedIterator.create(triples.iterator());
+	}
+
+	@Override
+	public ExtendedIterator<Triple> getTripleIterator(Node value) {
+		
+		// use POS index ( O(n), n= column count )
+		
+		if (value == null)
+			throw new NullPointerException("value is null");
+		
+		IteratorConcat<Triple> iter = new IteratorConcat<Triple>();
+		for (Column column : this.getColumns()) {
+			ExtendedIterator<Triple> eIter = getTripleIterator(column,value);
+			iter.add(eIter);
+		}
+		return WrappedIterator.create(Iter.distinct(iter));
+	}
+
+	@Override
+	public ExtendedIterator<Triple> getTripleIterator(Column column, Node value) {
+		
+		// use POS index directly (fast)
+		
+		if (column == null || column.getColumnKey() == null)
+			throw new NullPointerException("column is null");
+		
+		if (value == null)
+			throw new NullPointerException("value is null");
+		
+		
+		Node p = column.getColumnKey();
+		final SetMultimap<Node, Node> valueToSubjectMap = valueReverseIndex.get(p);
+		if ( valueToSubjectMap == null ) 
+		    return NullIterator.instance() ;
+		final Set<Node> subjects = valueToSubjectMap.get(value);
+		ArrayList<Triple> triples = new ArrayList<Triple>();
+		for (Node subject : subjects) {
+		    triples.add(Triple.create(subject, p, value));
+		}
+		return WrappedIterator.create(triples.iterator());
+	}
+
+
+	@Override
+	public ExtendedIterator<Triple> getTripleIterator(Row row) {
+		// use PSO index ( O(n), n= column count )
+		
+		if (row == null || row.getRowKey() == null)
+			throw new NullPointerException("row is null");
+		
+		ArrayList<Triple> triples = new ArrayList<Triple>();
+		for (Column column : getColumns()) {
+			Node value = row.getValue(column);
+			triples.add(Triple.create(row.getRowKey(), column.getColumnKey(), value));
+		}
+		return WrappedIterator.create(triples.iterator());
+	}
+
+	@Override
+	public Collection<Column> getColumns() {
+		return columnList;
+	}
+
+	@Override
+	public Column getColumn(Node p) {
+		if (p == null)
+			throw new NullPointerException("column node is null");
+		return columnIndex.get(p);
+	}
+
+	@Override
+	public Column createColumn(Node p) {
+		if (p == null)
+			throw new NullPointerException("column node is null");
+
+		if (columnIndex.containsKey(p))
+			throw new IllegalArgumentException("column already exists: '"
+					+ p.toString());
+
+		columnIndex.put(p, new ColumnImpl(this, p));
+		columnList.add(columnIndex.get(p));
+		valueIndex.put(p, new HashMap<Node, Node>());
+		valueReverseIndex.put(p, HashMultimap.create());
+		return getColumn(p);
+	}
+
+	@Override
+	public Row getRow(final Node s) {
+		if (s == null)
+			throw new NullPointerException("subject node is null");
+		Row row = rowIndex.get(s);
+		return row;
+
+	}
+	
+	@Override
+	public Row createRow(final Node s){
+		Row row = this.getRow(s);
+		if (row != null)
+			return row;
+
+		row = new InternalRow(s);
+		rowIndex.put(s, row);
+		rowList.add(row);
+
+		return row;
+	}
+	
+	@Override
+	public List<Row> getAllRows() {
+		return rowList;
+	}
+
+	
+	
+	@Override
+	public List<Node> getColumnValues(Column column) {
+		if (column == null || column.getColumnKey() == null)
+			throw new NullPointerException("column is null");
+		
+		Map<Node, Node> values = valueIndex.get(column.getColumnKey());
+
+		List<Node> list = new ArrayList<Node>(values.size());
+		list.addAll(values.values());
+		return list;
+	}
+	
+	@Override
+	public Collection<Row> getMatchingRows(Column column, Node value) {
+		if (column == null || column.getColumnKey() == null)
+			throw new NullPointerException("column is null");
+		
+		if (value == null)
+			throw new NullPointerException("value is null");
+		
+		
+		Node p = column.getColumnKey();
+		final SetMultimap<Node, Node> valueToSubjectMap = valueReverseIndex.get(p);
+		if ( valueToSubjectMap == null )
+		    return Collections.emptyList() ;
+		final Set<Node> subjects = valueToSubjectMap.get(value);
+		if ( subjects == null )
+		    return Collections.emptyList() ;
+		final ArrayList<Row> matchingRows = new ArrayList<Row>();
+		for (Node subject : subjects) {
+		    matchingRows.add(this.getRow(subject));
+		}
+		return matchingRows;
+	}
+
+	private final void setX(final Node s, final Node p, final Node value) {
+		if (p == null)
+			throw new NullPointerException("column Node must not be null.");
+		if (value == null)
+			throw new NullPointerException("value must not be null.");
+
+		Map<Node, Node> subjectToValueMap = valueIndex.get(p);
+		if (!columnIndex.containsKey(p) || subjectToValueMap == null)
+			throw new IllegalArgumentException("column: '" + p
+					+ "' does not yet exist.");
+
+		Node oldValue = subjectToValueMap.get(s);
+		subjectToValueMap.put(s, value);
+		addToReverseMap(p, s, oldValue, value);
+	}
+
+	private void addToReverseMap(final Node p, final Node s, final Node oldValue, final Node value) {
+
+		final SetMultimap<Node, Node> valueToSubjectMap = valueReverseIndex.get(p);
+		if ( valueToSubjectMap == null )
+            return ; 
+		valueToSubjectMap.remove(oldValue, s);
+		valueToSubjectMap.put(value, s);
+	}
+
+	private void unSetX(final Node s, final Node p) {
+
+		final Map<Node, Node> subjectToValueMap = valueIndex.get(p);
+		if (!columnIndex.containsKey(p) || subjectToValueMap == null)
+			throw new IllegalArgumentException("column: '" + p
+					+ "' does not yet exist.");
+
+		final Node value = subjectToValueMap.get(s);
+		if (value == null)
+			return;
+
+		subjectToValueMap.remove(s);
+		removeFromReverseMap(p, s, value);
+	}
+
+	private void removeFromReverseMap(final Node p, final Node s,
+			final Node value) {
+		final SetMultimap<Node, Node> valueTokeysMap = valueReverseIndex.get(p);
+		if ( valueTokeysMap == null )
+		    return ;
+		valueTokeysMap.remove(s, value);
+	}
+
+	private Node getX(final Node s, final Node p) {
+		final Map<Node, Node> subjectToValueMap = valueIndex.get(p);
+		if (!columnIndex.containsKey(p) || subjectToValueMap == null)
+			throw new IllegalArgumentException("column: '" + p
+					+ "' does not yet exist.");
+		return subjectToValueMap.get(s);
+	}
+
+	private final class InternalRow implements Row {
+		private final Node key;
+
+		InternalRow(final Node key) {
+			this.key = key;
+		}
+
+		@Override
+		public void setValue(Column column, Node value) {
+			if (value == null)
+				unSetX(key, column.getColumnKey());
+			else
+				setX(key, column.getColumnKey(), value);
+		}
+
+		@Override
+		public Node getValue(Column column) {
+			return getX(key, column.getColumnKey());
+		}
+		
+		@Override
+		public Node getValue(Node columnKey) {
+			return getX(key, columnKey);
+		}
+
+		@Override
+		public PropertyTable getTable() {
+			return PropertyTableHashMapImpl.this;
+		}
+
+		@Override
+		public Node getRowKey() {
+			return key;
+		}
+
+		@Override
+		public Collection<Column> getColumns() {
+			// TODO Auto-generated method stub
+			return PropertyTableHashMapImpl.this.getColumns();
+		}
+
+		@Override
+		public ExtendedIterator<Triple> getTripleIterator() {
+			ArrayList<Triple> triples = new ArrayList<Triple>();
+			for (Column column : getColumns()) {
+				Node value = this.getValue(column);
+				triples.add(Triple.create(key, column.getColumnKey(), value));
+			}
+			return WrappedIterator.create(triples.iterator());
+		}
+
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/d6ae87fd/jena-csv/src/main/java/org/apache/jena/propertytable/lang/LangCSV.java
----------------------------------------------------------------------
diff --git a/jena-csv/src/main/java/org/apache/jena/propertytable/lang/LangCSV.java b/jena-csv/src/main/java/org/apache/jena/propertytable/lang/LangCSV.java
index bd2ff29..d816f46 100644
--- a/jena-csv/src/main/java/org/apache/jena/propertytable/lang/LangCSV.java
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/lang/LangCSV.java
@@ -1,154 +1,154 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.propertytable.lang;
-
-import java.io.InputStream ;
-import java.io.Reader ;
-import java.util.ArrayList ;
-import java.util.List ;
-
-import org.apache.jena.atlas.csv.CSVParser ;
-import org.apache.jena.atlas.lib.IRILib ;
-import org.apache.jena.datatypes.xsd.XSDDatatype ;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.NodeFactory ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.system.* ;
-
-/**
- * The LangRIOT implementation for CSV
- *
- */
-public class LangCSV implements LangRIOT {
-
-    /** @deprecated Use {@linkplain CSV2RDF#init} */
-    @Deprecated
-    public static void register() { CSV2RDF.init() ; }
-    
-	public static final String CSV_PREFIX = "http://w3c/future-csv-vocab/";
-	public static final String CSV_ROW = CSV_PREFIX + "row";
-
-	private InputStream input = null;
-	private Reader reader = null;
-	private String base;
-	private String filename;
-	private StreamRDF sink;
-	private ParserProfile profile; // Warning - we don't use all of this.
-
-	@Override
-	public Lang getLang() {
-		return RDFLanguages.CSV;
-	}
-
-	@Override
-	public ParserProfile getProfile() {
-		return profile;
-	}
-
-	@Override
-	public void setProfile(ParserProfile profile) {
-		this.profile = profile;
-	}
-
-	public LangCSV(Reader reader, String base, String filename, ErrorHandler errorHandler, StreamRDF sink) {
-		this.reader = reader;
-		this.base = base;
-		this.filename = filename;
-		this.sink = sink;
-		this.profile = RiotLib.profile(getLang(), base, errorHandler);
-	}
-
-	public LangCSV(InputStream in, String base, String filename, ErrorHandler errorHandler, StreamRDF sink) {
-		this.input = in;
-		this.base = base;
-		this.filename = filename;
-		this.sink = sink;
-		this.profile = RiotLib.profile(getLang(), base, errorHandler);
-	}
-
-	@Override
-	public void parse() {
-		sink.start();
-		CSVParser parser = (input != null) ? CSVParser.create(input) : CSVParser.create(reader);
-		List<String> row = null;
-		ArrayList<Node> predicates = new ArrayList<Node>();
-		int rowNum = 0;
-		while ((row = parser.parse1()) != null) {
-			
-			if (rowNum == 0) {
-				for (String column : row) {
-					String uri = IRIResolver.resolveString(filename) + "#"
-							+ toSafeLocalname(column);
-					Node predicate = this.profile.createURI(uri, rowNum, 0);
-					predicates.add(predicate);
-				}
-			} else {
-				//Node subject = this.profile.createBlankNode(null, -1, -1);
-				Node subject = caculateSubject(rowNum, filename);
-				Node predicateRow = this.profile.createURI(CSV_ROW, -1, -1);
-				Node objectRow = this.profile
-						.createTypedLiteral((rowNum + ""),
-								XSDDatatype.XSDinteger, rowNum, 0);
-				sink.triple(this.profile.createTriple(subject, predicateRow,
-						objectRow, rowNum, 0));
-				for (int col = 0; col < row.size() && col<predicates.size(); col++) {
-					Node predicate = predicates.get(col);
-					String columnValue = row.get(col).trim();
-					if("".equals(columnValue)){
-						continue;
-					}					
-					Node o;
-					try {
-						// Try for a double.
-						double d = Double.parseDouble(columnValue);
-						o = NodeFactory.createLiteral(columnValue,
-								XSDDatatype.XSDdouble);
-					} catch (Exception e) {
-						o = NodeFactory.createLiteral(columnValue);
-					}
-					sink.triple(this.profile.createTriple(subject, predicate,
-							o, rowNum, col));
-				}
-
-			}
-			rowNum++;
-		}
-		sink.finish();
-
-	}
-
-	public static String toSafeLocalname(String raw) {
-		String ret = raw.trim();
-		return encodeURIComponent(ret);
-		
-	}
-	
-	public static String encodeURIComponent(String s) {
-	    return IRILib.encodeUriComponent(s);
-	}
-	
-	public static Node caculateSubject(int rowNum, String filename){
-		Node subject = NodeFactory.createBlankNode();
-//		String uri = IRIResolver.resolveString(filename) + "#Row_" + rowNum; 
-//		Node subject =  NodeFactory.createURI(uri);
-		return subject;
-	}
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.propertytable.lang;
+
+import java.io.InputStream ;
+import java.io.Reader ;
+import java.util.ArrayList ;
+import java.util.List ;
+
+import org.apache.jena.atlas.csv.CSVParser ;
+import org.apache.jena.atlas.lib.IRILib ;
+import org.apache.jena.datatypes.xsd.XSDDatatype ;
+import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.NodeFactory ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFLanguages ;
+import org.apache.jena.riot.lang.LangRIOT ;
+import org.apache.jena.riot.system.* ;
+
+/**
+ * The LangRIOT implementation for CSV
+ *
+ */
+public class LangCSV implements LangRIOT {
+
+    /** @deprecated Use {@linkplain CSV2RDF#init} */
+    @Deprecated
+    public static void register() { CSV2RDF.init() ; }
+    
+	public static final String CSV_PREFIX = "http://w3c/future-csv-vocab/";
+	public static final String CSV_ROW = CSV_PREFIX + "row";
+
+	private InputStream input = null;
+	private Reader reader = null;
+	private String base;
+	private String filename;
+	private StreamRDF sink;
+	private ParserProfile profile; // Warning - we don't use all of this.
+
+	@Override
+	public Lang getLang() {
+		return RDFLanguages.CSV;
+	}
+
+	@Override
+	public ParserProfile getProfile() {
+		return profile;
+	}
+
+	@Override
+	public void setProfile(ParserProfile profile) {
+		this.profile = profile;
+	}
+
+	public LangCSV(Reader reader, String base, String filename, ErrorHandler errorHandler, StreamRDF sink) {
+		this.reader = reader;
+		this.base = base;
+		this.filename = filename;
+		this.sink = sink;
+		this.profile = RiotLib.profile(getLang(), base, errorHandler);
+	}
+
+	public LangCSV(InputStream in, String base, String filename, ErrorHandler errorHandler, StreamRDF sink) {
+		this.input = in;
+		this.base = base;
+		this.filename = filename;
+		this.sink = sink;
+		this.profile = RiotLib.profile(getLang(), base, errorHandler);
+	}
+
+	@Override
+	public void parse() {
+		sink.start();
+		CSVParser parser = (input != null) ? CSVParser.create(input) : CSVParser.create(reader);
+		List<String> row = null;
+		ArrayList<Node> predicates = new ArrayList<Node>();
+		int rowNum = 0;
+		while ((row = parser.parse1()) != null) {
+			
+			if (rowNum == 0) {
+				for (String column : row) {
+					String uri = IRIResolver.resolveString(filename) + "#"
+							+ toSafeLocalname(column);
+					Node predicate = this.profile.createURI(uri, rowNum, 0);
+					predicates.add(predicate);
+				}
+			} else {
+				//Node subject = this.profile.createBlankNode(null, -1, -1);
+				Node subject = caculateSubject(rowNum, filename);
+				Node predicateRow = this.profile.createURI(CSV_ROW, -1, -1);
+				Node objectRow = this.profile
+						.createTypedLiteral((rowNum + ""),
+								XSDDatatype.XSDinteger, rowNum, 0);
+				sink.triple(this.profile.createTriple(subject, predicateRow,
+						objectRow, rowNum, 0));
+				for (int col = 0; col < row.size() && col<predicates.size(); col++) {
+					Node predicate = predicates.get(col);
+					String columnValue = row.get(col).trim();
+					if("".equals(columnValue)){
+						continue;
+					}					
+					Node o;
+					try {
+						// Try for a double.
+						double d = Double.parseDouble(columnValue);
+						o = NodeFactory.createLiteral(columnValue,
+								XSDDatatype.XSDdouble);
+					} catch (Exception e) {
+						o = NodeFactory.createLiteral(columnValue);
+					}
+					sink.triple(this.profile.createTriple(subject, predicate,
+							o, rowNum, col));
+				}
+
+			}
+			rowNum++;
+		}
+		sink.finish();
+
+	}
+
+	public static String toSafeLocalname(String raw) {
+		String ret = raw.trim();
+		return encodeURIComponent(ret);
+		
+	}
+	
+	public static String encodeURIComponent(String s) {
+	    return IRILib.encodeUriComponent(s);
+	}
+	
+	public static Node caculateSubject(int rowNum, String filename){
+		Node subject = NodeFactory.createBlankNode();
+//		String uri = IRIResolver.resolveString(filename) + "#Row_" + rowNum; 
+//		Node subject =  NodeFactory.createURI(uri);
+		return subject;
+	}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/d6ae87fd/jena-csv/src/main/java/riotcmdx/csv2rdf.java
----------------------------------------------------------------------
diff --git a/jena-csv/src/main/java/riotcmdx/csv2rdf.java b/jena-csv/src/main/java/riotcmdx/csv2rdf.java
index eda3d8a..cd8929d 100644
--- a/jena-csv/src/main/java/riotcmdx/csv2rdf.java
+++ b/jena-csv/src/main/java/riotcmdx/csv2rdf.java
@@ -1,52 +1,52 @@
-/*
- * 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 riotcmdx;
-
-import org.apache.jena.atlas.lib.Lib ;
-import org.apache.jena.atlas.web.ContentType ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFLanguages ;
-import riotcmd.CmdLangParse ;
-
-/**
- * A command line tool for direct and scalable transforming from CSV to the formatted RDF syntax (i.e. N-Triples), 
- * with no intermediary Graph or PropertyTable.
- */
-public class csv2rdf extends CmdLangParse{
-	
-    public static void main(String... argv)
-    {
-        new csv2rdf(argv).mainRun() ;
-    }    
-    
-    protected csv2rdf(String[] argv)
-    {
-        super(argv) ;
-    }
-	
-	@Override
-	protected Lang selectLang(String filename, ContentType contentType, Lang dftLang) {
-		return RDFLanguages.CSV; 
-	}
-
-	@Override
-	protected String getCommandName() {
-		return Lib.classShortName(csv2rdf.class) ;
-	}
-}
+/*
+ * 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 riotcmdx;
+
+import org.apache.jena.atlas.lib.Lib ;
+import org.apache.jena.atlas.web.ContentType ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFLanguages ;
+import riotcmd.CmdLangParse ;
+
+/**
+ * A command line tool for direct and scalable transforming from CSV to the formatted RDF syntax (i.e. N-Triples), 
+ * with no intermediary Graph or PropertyTable.
+ */
+public class csv2rdf extends CmdLangParse{
+	
+    public static void main(String... argv)
+    {
+        new csv2rdf(argv).mainRun() ;
+    }    
+    
+    protected csv2rdf(String[] argv)
+    {
+        super(argv) ;
+    }
+	
+	@Override
+	protected Lang selectLang(String filename, ContentType contentType, Lang dftLang) {
+		return RDFLanguages.CSV; 
+	}
+
+	@Override
+	protected String getCommandName() {
+		return Lib.classShortName(csv2rdf.class) ;
+	}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/d6ae87fd/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractColumnTest.java
----------------------------------------------------------------------
diff --git a/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractColumnTest.java b/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractColumnTest.java
index a41161e..fed4517 100644
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractColumnTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractColumnTest.java
@@ -1,79 +1,79 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.propertytable;
-
-import java.util.List;
-
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.NodeFactory ;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Tests related to Column.
- *
- */
-public abstract class AbstractColumnTest extends BaseTest{
-
-
-	@Test(expected = NullPointerException.class)
-	public void testCreateColumnWithArgNull() {
-		table.createColumn(null);
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void testCreateListColumnWithAlreadyExistingCoulmnName() {
-		table.createColumn(URI("something"));
-		table.createColumn(URI("something"));
-	}
-	
-	@Test
-	public void testColumnCreate() {
-		table.createColumn(URI("something"));
-		Assert.assertEquals(1, table.getColumns().size());
-		Assert.assertTrue(collectionContains(table.getColumns(), URI("something")));
-	}
-	
-	@Test
-	public void testGetColumnValues() {
-		Column something = table.createColumn(URI("something"));
-		final Row row1 = table.createRow(NodeFactory.createBlankNode());
-		row1.setValue(something, URI("apple"));
-		final Row row2 = table.createRow(NodeFactory.createBlankNode());
-		row2.setValue(something, URI("orange"));
-		final List<Node> values = something.getValues();
-		Assert.assertTrue(values.size() == 2);
-		Assert.assertTrue(values.contains( URI("apple")));
-		Assert.assertTrue(values.contains(  URI("orange")));
-	}
-	
-	@Test
-	public void testGetColumn() {
-		table.createColumn(URI("something"));
-		Assert.assertNotNull(table.getColumn(URI("something")));
-		Assert.assertNull(table.getColumn( URI("nonExistentColumnName")));
-	}
-
-	@Test
-	public void testGetTable() {
-		Column something = table.createColumn(URI("something"));
-		Assert.assertEquals(table, something.getTable());
-	}
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.propertytable;
+
+import java.util.List;
+
+import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.NodeFactory ;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests related to Column.
+ *
+ */
+public abstract class AbstractColumnTest extends BaseTest{
+
+
+	@Test(expected = NullPointerException.class)
+	public void testCreateColumnWithArgNull() {
+		table.createColumn(null);
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void testCreateListColumnWithAlreadyExistingCoulmnName() {
+		table.createColumn(URI("something"));
+		table.createColumn(URI("something"));
+	}
+	
+	@Test
+	public void testColumnCreate() {
+		table.createColumn(URI("something"));
+		Assert.assertEquals(1, table.getColumns().size());
+		Assert.assertTrue(collectionContains(table.getColumns(), URI("something")));
+	}
+	
+	@Test
+	public void testGetColumnValues() {
+		Column something = table.createColumn(URI("something"));
+		final Row row1 = table.createRow(NodeFactory.createBlankNode());
+		row1.setValue(something, URI("apple"));
+		final Row row2 = table.createRow(NodeFactory.createBlankNode());
+		row2.setValue(something, URI("orange"));
+		final List<Node> values = something.getValues();
+		Assert.assertTrue(values.size() == 2);
+		Assert.assertTrue(values.contains( URI("apple")));
+		Assert.assertTrue(values.contains(  URI("orange")));
+	}
+	
+	@Test
+	public void testGetColumn() {
+		table.createColumn(URI("something"));
+		Assert.assertNotNull(table.getColumn(URI("something")));
+		Assert.assertNull(table.getColumn( URI("nonExistentColumnName")));
+	}
+
+	@Test
+	public void testGetTable() {
+		Column something = table.createColumn(URI("something"));
+		Assert.assertEquals(table, something.getTable());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/d6ae87fd/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractPropertyTableTest.java
----------------------------------------------------------------------
diff --git a/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractPropertyTableTest.java b/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractPropertyTableTest.java
index 5209361..a9544f9 100644
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractPropertyTableTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractPropertyTableTest.java
@@ -1,56 +1,56 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.propertytable;
-
-import java.util.Collection;
-
-import org.apache.jena.graph.NodeFactory ;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Tests related to PropertyTable.
- *
- */
-public abstract class AbstractPropertyTableTest extends AbstractRowTest{
-
-	@Test
-	public void testGetMatchingColumns() {
-		Column something = table.createColumn(URI("something") );
-		final Row row1 = table.createRow(NodeFactory.createBlankNode());
-		row1.setValue(something, URI("apple"));
-		final Row row2 = table.createRow(NodeFactory.createBlankNode());
-		row2.setValue(something, URI("orange"));
-		Collection<Row> matchingRows = table.getMatchingRows(something, URI("apple"));
-		Assert.assertTrue(matchingRows.size() == 1);
-		matchingRows = table.getMatchingRows(something, URI("banana"));
-		Assert.assertTrue(matchingRows.isEmpty());
-	}
-	
-	@Test
-	public void testGetAllRows() {
-		Assert.assertTrue(table.getAllRows().size() == 1);
-		table.createRow(NodeFactory.createBlankNode());
-		Assert.assertTrue(table.getAllRows().size() == 2);
-		table.createRow(NodeFactory.createBlankNode());
-		Assert.assertTrue(table.getAllRows().size() == 3);
-	}
-
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.propertytable;
+
+import java.util.Collection;
+
+import org.apache.jena.graph.NodeFactory ;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests related to PropertyTable.
+ *
+ */
+public abstract class AbstractPropertyTableTest extends AbstractRowTest{
+
+	@Test
+	public void testGetMatchingColumns() {
+		Column something = table.createColumn(URI("something") );
+		final Row row1 = table.createRow(NodeFactory.createBlankNode());
+		row1.setValue(something, URI("apple"));
+		final Row row2 = table.createRow(NodeFactory.createBlankNode());
+		row2.setValue(something, URI("orange"));
+		Collection<Row> matchingRows = table.getMatchingRows(something, URI("apple"));
+		Assert.assertTrue(matchingRows.size() == 1);
+		matchingRows = table.getMatchingRows(something, URI("banana"));
+		Assert.assertTrue(matchingRows.isEmpty());
+	}
+	
+	@Test
+	public void testGetAllRows() {
+		Assert.assertTrue(table.getAllRows().size() == 1);
+		table.createRow(NodeFactory.createBlankNode());
+		Assert.assertTrue(table.getAllRows().size() == 2);
+		table.createRow(NodeFactory.createBlankNode());
+		Assert.assertTrue(table.getAllRows().size() == 3);
+	}
+
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/d6ae87fd/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractRowTest.java
----------------------------------------------------------------------
diff --git a/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractRowTest.java b/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractRowTest.java
index 3e16033..20598a9 100644
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractRowTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractRowTest.java
@@ -1,105 +1,105 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.propertytable;
-
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.NodeFactory ;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Tests related to Row.
- *
- */
-public abstract class AbstractRowTest extends AbstractColumnTest{
-
-	@Test
-	public void testAddRowValue() {
-
-		Column something = table.createColumn(URI("something"));
-		Column somethingElse = table.createColumn(URI("somethingElse"));
-
-		row.setValue(something, URI("apple"));
-		row.setValue(somethingElse, URI("orange"));
-
-		Assert.assertEquals(URI("apple"), row.getValue(something));
-		Assert.assertEquals(URI("orange"), row.getValue(somethingElse));
-	}
-	
-	@Test
-	public void testUnsetRowValue() {
-		Column something = table.createColumn(URI("something"));
-		row.setValue( something , URI("apple"));
-		Assert.assertEquals(URI("apple"), row.getValue(something));
-		row.setValue( something , null);
-		Assert.assertEquals(null, row.getValue(something));
-	}
-	
-	@Test(expected=NullPointerException.class)
-	public void testGetRowWithNullKey() {
-		table.getRow(null);
-	}
-	
-	@Test(expected = NullPointerException.class)
-	public void testAddValueToNotExistingColumn() {
-		row.setValue(table.getColumn(URI("something")), URI("apple"));
-	}
-	
-
-	
-	@Test(expected=IllegalArgumentException.class)
-	public void testGetListWithANonExistantColumn() {
-		Assert.assertNull(row.getValue( NodeFactory.createBlankNode() ));
-	}
-	
-	@Test
-	public void testGetListWithAnMissingRowValue() {
-		Column something = table.createColumn(URI("something"));
-		Assert.assertNull(row.getValue(something));
-	}
-
-    @Test
-    public void testGetValue() {
-    	Column something = table.createColumn(URI("something"));
-        row.setValue(something, URI("apple"));
-        Node value = row.getValue(something);
-        Assert.assertEquals(URI("apple"), value);
-    }
-    
-    @Test
-    public void testRowExistsFalse(){
-    	Assert.assertNull(table.getRow(NodeFactory.createBlankNode()));
-    }
-    
-    @Test
-    public void testRowExistsTrue() {
-		Assert.assertNotNull(table.getRow(rowSubject));
-    }
-
-    @Test
-    public void testGetRowFalseAndDoesntCreateRow() {
-    	Assert.assertNull(table.getRow(NodeFactory.createBlankNode()));
-    	Assert.assertNull(table.getRow(NodeFactory.createBlankNode()));
-    }
-    
-    @Test(expected=IllegalArgumentException.class)
-	public void testGetValueBeforeColumnExists() {
-		row.getValue(URI("nonexistentColumnX"));
-	}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.propertytable;
+
+import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.NodeFactory ;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests related to Row.
+ *
+ */
+public abstract class AbstractRowTest extends AbstractColumnTest{
+
+	@Test
+	public void testAddRowValue() {
+
+		Column something = table.createColumn(URI("something"));
+		Column somethingElse = table.createColumn(URI("somethingElse"));
+
+		row.setValue(something, URI("apple"));
+		row.setValue(somethingElse, URI("orange"));
+
+		Assert.assertEquals(URI("apple"), row.getValue(something));
+		Assert.assertEquals(URI("orange"), row.getValue(somethingElse));
+	}
+	
+	@Test
+	public void testUnsetRowValue() {
+		Column something = table.createColumn(URI("something"));
+		row.setValue( something , URI("apple"));
+		Assert.assertEquals(URI("apple"), row.getValue(something));
+		row.setValue( something , null);
+		Assert.assertEquals(null, row.getValue(something));
+	}
+	
+	@Test(expected=NullPointerException.class)
+	public void testGetRowWithNullKey() {
+		table.getRow(null);
+	}
+	
+	@Test(expected = NullPointerException.class)
+	public void testAddValueToNotExistingColumn() {
+		row.setValue(table.getColumn(URI("something")), URI("apple"));
+	}
+	
+
+	
+	@Test(expected=IllegalArgumentException.class)
+	public void testGetListWithANonExistantColumn() {
+		Assert.assertNull(row.getValue( NodeFactory.createBlankNode() ));
+	}
+	
+	@Test
+	public void testGetListWithAnMissingRowValue() {
+		Column something = table.createColumn(URI("something"));
+		Assert.assertNull(row.getValue(something));
+	}
+
+    @Test
+    public void testGetValue() {
+    	Column something = table.createColumn(URI("something"));
+        row.setValue(something, URI("apple"));
+        Node value = row.getValue(something);
+        Assert.assertEquals(URI("apple"), value);
+    }
+    
+    @Test
+    public void testRowExistsFalse(){
+    	Assert.assertNull(table.getRow(NodeFactory.createBlankNode()));
+    }
+    
+    @Test
+    public void testRowExistsTrue() {
+		Assert.assertNotNull(table.getRow(rowSubject));
+    }
+
+    @Test
+    public void testGetRowFalseAndDoesntCreateRow() {
+    	Assert.assertNull(table.getRow(NodeFactory.createBlankNode()));
+    	Assert.assertNull(table.getRow(NodeFactory.createBlankNode()));
+    }
+    
+    @Test(expected=IllegalArgumentException.class)
+	public void testGetValueBeforeColumnExists() {
+		row.getValue(URI("nonexistentColumnX"));
+	}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/d6ae87fd/jena-csv/src/test/java/org/apache/jena/propertytable/BaseTest.java
----------------------------------------------------------------------
diff --git a/jena-csv/src/test/java/org/apache/jena/propertytable/BaseTest.java b/jena-csv/src/test/java/org/apache/jena/propertytable/BaseTest.java
index 8e36236..f0f6093 100644
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/BaseTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/BaseTest.java
@@ -1,47 +1,47 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.propertytable;
-
-import java.util.Collection;
-
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.NodeFactory ;
-
-public abstract class BaseTest {
-	protected PropertyTable table;
-	protected PropertyTable table2;
-	protected Row row;
-	private static final String ns = "eh:foo/bar#";
-	protected static final Node rowSubject = URI("rowSubject");
-	protected static final String csvFilePath = "src/test/resources/test.csv";
-	
-	
-	protected static Node URI(String localName) {
-		return NodeFactory.createURI(ns + localName);
-	}
-	
-	protected static boolean collectionContains(
-			final Collection<Column> columns, final Node columnkey) {
-		for (final Column column : columns) {
-			if (column.getColumnKey().equals(columnkey))
-				return true;
-		}
-		return false;
-	}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.propertytable;
+
+import java.util.Collection;
+
+import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.NodeFactory ;
+
+public abstract class BaseTest {
+	protected PropertyTable table;
+	protected PropertyTable table2;
+	protected Row row;
+	private static final String ns = "eh:foo/bar#";
+	protected static final Node rowSubject = URI("rowSubject");
+	protected static final String csvFilePath = "src/test/resources/test.csv";
+	
+	
+	protected static Node URI(String localName) {
+		return NodeFactory.createURI(ns + localName);
+	}
+	
+	protected static boolean collectionContains(
+			final Collection<Column> columns, final Node columnkey) {
+		for (final Column column : columns) {
+			if (column.getColumnKey().equals(columnkey))
+				return true;
+		}
+		return false;
+	}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/d6ae87fd/jena-csv/src/test/java/org/apache/jena/propertytable/TS_PropertyTable.java
----------------------------------------------------------------------
diff --git a/jena-csv/src/test/java/org/apache/jena/propertytable/TS_PropertyTable.java b/jena-csv/src/test/java/org/apache/jena/propertytable/TS_PropertyTable.java
index 084365d..d6a0d2a 100644
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/TS_PropertyTable.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/TS_PropertyTable.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.propertytable;
-
-import org.apache.jena.propertytable.graph.GraphCSVTest;
-import org.apache.jena.propertytable.impl.PropertyTableArrayImplTest;
-import org.apache.jena.propertytable.impl.PropertyTableBuilderForArrayImplTest;
-import org.apache.jena.propertytable.impl.PropertyTableBuilderForHashMapImplTest;
-import org.apache.jena.propertytable.impl.PropertyTableHashMapImplTest;
-import org.apache.jena.propertytable.lang.TestLangCSV;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
-	PropertyTableArrayImplTest.class,
-	PropertyTableHashMapImplTest.class,
-	GraphCSVTest.class,
-	PropertyTableBuilderForArrayImplTest.class,
-	PropertyTableBuilderForHashMapImplTest.class,
-	TestLangCSV.class
-})
-public class TS_PropertyTable {
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.propertytable;
+
+import org.apache.jena.propertytable.graph.GraphCSVTest;
+import org.apache.jena.propertytable.impl.PropertyTableArrayImplTest;
+import org.apache.jena.propertytable.impl.PropertyTableBuilderForArrayImplTest;
+import org.apache.jena.propertytable.impl.PropertyTableBuilderForHashMapImplTest;
+import org.apache.jena.propertytable.impl.PropertyTableHashMapImplTest;
+import org.apache.jena.propertytable.lang.TestLangCSV;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {
+	PropertyTableArrayImplTest.class,
+	PropertyTableHashMapImplTest.class,
+	GraphCSVTest.class,
+	PropertyTableBuilderForArrayImplTest.class,
+	PropertyTableBuilderForHashMapImplTest.class,
+	TestLangCSV.class
+})
+public class TS_PropertyTable {
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/d6ae87fd/jena-csv/src/test/java/org/apache/jena/propertytable/graph/GraphCSVTest.java
----------------------------------------------------------------------
diff --git a/jena-csv/src/test/java/org/apache/jena/propertytable/graph/GraphCSVTest.java b/jena-csv/src/test/java/org/apache/jena/propertytable/graph/GraphCSVTest.java
index b81f37f..2534287 100644
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/graph/GraphCSVTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/graph/GraphCSVTest.java
@@ -1,154 +1,154 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.propertytable.graph;
-
-import org.apache.jena.atlas.lib.StrUtils ;
-import org.apache.jena.propertytable.lang.CSV2RDF ;
-import org.apache.jena.query.* ;
-import org.apache.jena.rdf.model.Model ;
-import org.apache.jena.rdf.model.ModelFactory ;
-import org.apache.jena.sparql.engine.main.StageBuilder ;
-import org.apache.jena.sparql.engine.main.StageGenerator ;
-import org.junit.Assert ;
-import org.junit.BeforeClass ;
-import org.junit.Test ;
-
-/**
- * Tests related to GraphCSV with some real world data.
- */
-public class GraphCSVTest extends Assert {
-	
-	@BeforeClass
-	public static void init(){
-		CSV2RDF.init() ;
-	}
-	
-	@Test
-	public void testGraphCSV() {
-		//String file = "src/test/resources/HEFCE_organogram_senior_data_31032011.csv";test.csv
-		String file = "src/test/resources/test.csv";
-		
-		Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
-		assertEquals(12, csv.size());
-
-		Query query = QueryFactory
-				.create("PREFIX : <src/test/resources/test.csv#> SELECT ?townName ?pop {?x :Town ?townName ; :Population ?pop ; :Predicate%20With%20Space 'PredicateWithSpace2' . FILTER(?pop > 500000)}");
-		
-		QueryExecution qexec = QueryExecutionFactory.create(query, csv);
-		ResultSet results = qexec.execSelect();
-		
-		assertTrue(results.hasNext());
-		QuerySolution soln = results.nextSolution();
-		assertEquals( "Northville", soln.getLiteral("townName").getString());
-		assertTrue( 654000 == soln.getLiteral("pop").getInt());
-		
-		assertFalse(results.hasNext());
-	}
-	
-	@Test 
-	public void stageGeneratorTest(){
-		wireIntoExecution();
-		testGraphCSV();
-	}
-	
-    private static void wireIntoExecution() {
-        StageGenerator orig = (StageGenerator)ARQ.getContext().get(ARQ.stageGenerator) ;
-        StageGenerator stageGenerator = new StageGeneratorPropertyTable(orig) ;
-        StageBuilder.setGenerator(ARQ.getContext(), stageGenerator) ;
-    }
-	
-	//http://www.w3.org/TR/csvw-ucr/#UC-OrganogramData
-	//2.4 Use Case #4 - Publication of public sector roles and salaries
-	@Test
-	public void testUseCase4(){
-		String file = "src/test/resources/HEFCE_organogram_senior_data_31032011.csv";
-		
-		Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
-		assertEquals(72, csv.size());
-
-		String x = StrUtils.strjoinNL
-		    ("PREFIX : <src/test/resources/HEFCE_organogram_senior_data_31032011.csv#>"
-		    ,"SELECT ?name ?unit"
-		    ,"{ ?x :Name ?name ;"
-		    ,"     :Unit ?unit ;"
-		    ,"     :Actual%20Pay%20Floor%20%28%A3%29 ?floor ;"
-		    ,"     :Actual%20Pay%20Ceiling%20%28%A3%29 ?ceiling ."
-		    ,"FILTER(?floor > 100000 && ?ceiling <120000 )"
-		    ,"}");
-		
-		Query query = QueryFactory.create(x) ;
-		
-		QueryExecution qexec = QueryExecutionFactory.create(query, csv);
-		ResultSet results = qexec.execSelect();
-		
-		assertTrue(results.hasNext());
-		QuerySolution soln = results.nextSolution();
-		assertEquals( "David Sweeney", soln.getLiteral("name").getString());
-		assertEquals( "Research, Innovation and Skills", soln.getLiteral("unit").getString());
-		
-		assertFalse(results.hasNext());
-	}
-	
-	
-	//http://www.w3.org/TR/csvw-ucr/#UC-JournalArticleSearch
-	//2.6 Use Case #6 - Journal Article Solr Search Results
-	@Test
-	public void testUseCase6(){
-		String file = "src/test/resources/PLOSone-search-results.csv";
-		
-		Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
-		assertEquals(30, csv.size());
-
-		Query query = QueryFactory
-				.create("PREFIX : <src/test/resources/PLOSone-search-results.csv#> SELECT ?author {?x :author ?author ; :doi '10.1371/journal.pone.0095156' }");
-		
-		QueryExecution qexec = QueryExecutionFactory.create(query, csv);
-		ResultSet results = qexec.execSelect();
-		
-		assertTrue(results.hasNext());
-		QuerySolution soln = results.nextSolution();
-		assertEquals( "Oshrat Raz,Dorit L Lev,Alexander Battler,Eli I Lev", soln.getLiteral("author").getString());
-		
-		assertFalse(results.hasNext());
-	}
-	
-	//http://www.w3.org/TR/csvw-ucr/#UC-PaloAltoTreeData
-	//2.11 Use Case #11 - City of Palo Alto Tree Data
-	@Test
-	public void testUseCase11(){
-		String file = "src/test/resources/Palo_Alto_Trees.csv";
-		
-		Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
-		assertEquals(199, csv.size());
-
-		Query query = QueryFactory
-				.create("PREFIX : <src/test/resources/Palo_Alto_Trees.csv#> SELECT ?longitude ?latitude {?x :Longitude ?longitude ; :Latitude ?latitude ; :Distance%20from%20Property ?distance . FILTER(?distance > 50 )}");
-		
-		QueryExecution qexec = QueryExecutionFactory.create(query, csv);
-		ResultSet results = qexec.execSelect();
-		
-		assertTrue(results.hasNext());
-		QuerySolution soln = results.nextSolution();
-		assertEquals( -122.1566921, soln.getLiteral("longitude").getDouble(), 0);
-		assertEquals( 37.4408948, soln.getLiteral("latitude").getDouble(), 0);
-		
-		assertFalse(results.hasNext());
-	}
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.propertytable.graph;
+
+import org.apache.jena.atlas.lib.StrUtils ;
+import org.apache.jena.propertytable.lang.CSV2RDF ;
+import org.apache.jena.query.* ;
+import org.apache.jena.rdf.model.Model ;
+import org.apache.jena.rdf.model.ModelFactory ;
+import org.apache.jena.sparql.engine.main.StageBuilder ;
+import org.apache.jena.sparql.engine.main.StageGenerator ;
+import org.junit.Assert ;
+import org.junit.BeforeClass ;
+import org.junit.Test ;
+
+/**
+ * Tests related to GraphCSV with some real world data.
+ */
+public class GraphCSVTest extends Assert {
+	
+	@BeforeClass
+	public static void init(){
+		CSV2RDF.init() ;
+	}
+	
+	@Test
+	public void testGraphCSV() {
+		//String file = "src/test/resources/HEFCE_organogram_senior_data_31032011.csv";test.csv
+		String file = "src/test/resources/test.csv";
+		
+		Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
+		assertEquals(12, csv.size());
+
+		Query query = QueryFactory
+				.create("PREFIX : <src/test/resources/test.csv#> SELECT ?townName ?pop {?x :Town ?townName ; :Population ?pop ; :Predicate%20With%20Space 'PredicateWithSpace2' . FILTER(?pop > 500000)}");
+		
+		QueryExecution qexec = QueryExecutionFactory.create(query, csv);
+		ResultSet results = qexec.execSelect();
+		
+		assertTrue(results.hasNext());
+		QuerySolution soln = results.nextSolution();
+		assertEquals( "Northville", soln.getLiteral("townName").getString());
+		assertTrue( 654000 == soln.getLiteral("pop").getInt());
+		
+		assertFalse(results.hasNext());
+	}
+	
+	@Test 
+	public void stageGeneratorTest(){
+		wireIntoExecution();
+		testGraphCSV();
+	}
+	
+    private static void wireIntoExecution() {
+        StageGenerator orig = (StageGenerator)ARQ.getContext().get(ARQ.stageGenerator) ;
+        StageGenerator stageGenerator = new StageGeneratorPropertyTable(orig) ;
+        StageBuilder.setGenerator(ARQ.getContext(), stageGenerator) ;
+    }
+	
+	//http://www.w3.org/TR/csvw-ucr/#UC-OrganogramData
+	//2.4 Use Case #4 - Publication of public sector roles and salaries
+	@Test
+	public void testUseCase4(){
+		String file = "src/test/resources/HEFCE_organogram_senior_data_31032011.csv";
+		
+		Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
+		assertEquals(72, csv.size());
+
+		String x = StrUtils.strjoinNL
+		    ("PREFIX : <src/test/resources/HEFCE_organogram_senior_data_31032011.csv#>"
+		    ,"SELECT ?name ?unit"
+		    ,"{ ?x :Name ?name ;"
+		    ,"     :Unit ?unit ;"
+		    ,"     :Actual%20Pay%20Floor%20%28%A3%29 ?floor ;"
+		    ,"     :Actual%20Pay%20Ceiling%20%28%A3%29 ?ceiling ."
+		    ,"FILTER(?floor > 100000 && ?ceiling <120000 )"
+		    ,"}");
+		
+		Query query = QueryFactory.create(x) ;
+		
+		QueryExecution qexec = QueryExecutionFactory.create(query, csv);
+		ResultSet results = qexec.execSelect();
+		
+		assertTrue(results.hasNext());
+		QuerySolution soln = results.nextSolution();
+		assertEquals( "David Sweeney", soln.getLiteral("name").getString());
+		assertEquals( "Research, Innovation and Skills", soln.getLiteral("unit").getString());
+		
+		assertFalse(results.hasNext());
+	}
+	
+	
+	//http://www.w3.org/TR/csvw-ucr/#UC-JournalArticleSearch
+	//2.6 Use Case #6 - Journal Article Solr Search Results
+	@Test
+	public void testUseCase6(){
+		String file = "src/test/resources/PLOSone-search-results.csv";
+		
+		Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
+		assertEquals(30, csv.size());
+
+		Query query = QueryFactory
+				.create("PREFIX : <src/test/resources/PLOSone-search-results.csv#> SELECT ?author {?x :author ?author ; :doi '10.1371/journal.pone.0095156' }");
+		
+		QueryExecution qexec = QueryExecutionFactory.create(query, csv);
+		ResultSet results = qexec.execSelect();
+		
+		assertTrue(results.hasNext());
+		QuerySolution soln = results.nextSolution();
+		assertEquals( "Oshrat Raz,Dorit L Lev,Alexander Battler,Eli I Lev", soln.getLiteral("author").getString());
+		
+		assertFalse(results.hasNext());
+	}
+	
+	//http://www.w3.org/TR/csvw-ucr/#UC-PaloAltoTreeData
+	//2.11 Use Case #11 - City of Palo Alto Tree Data
+	@Test
+	public void testUseCase11(){
+		String file = "src/test/resources/Palo_Alto_Trees.csv";
+		
+		Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
+		assertEquals(199, csv.size());
+
+		Query query = QueryFactory
+				.create("PREFIX : <src/test/resources/Palo_Alto_Trees.csv#> SELECT ?longitude ?latitude {?x :Longitude ?longitude ; :Latitude ?latitude ; :Distance%20from%20Property ?distance . FILTER(?distance > 50 )}");
+		
+		QueryExecution qexec = QueryExecutionFactory.create(query, csv);
+		ResultSet results = qexec.execSelect();
+		
+		assertTrue(results.hasNext());
+		QuerySolution soln = results.nextSolution();
+		assertEquals( -122.1566921, soln.getLiteral("longitude").getDouble(), 0);
+		assertEquals( 37.4408948, soln.getLiteral("latitude").getDouble(), 0);
+		
+		assertFalse(results.hasNext());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/d6ae87fd/jena-csv/src/test/java/org/apache/jena/propertytable/impl/AbstractPropertyTableBuilderTest.java
----------------------------------------------------------------------
diff --git a/jena-csv/src/test/java/org/apache/jena/propertytable/impl/AbstractPropertyTableBuilderTest.java b/jena-csv/src/test/java/org/apache/jena/propertytable/impl/AbstractPropertyTableBuilderTest.java
index a00d3fd..9100096 100644
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/impl/AbstractPropertyTableBuilderTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/impl/AbstractPropertyTableBuilderTest.java
@@ -1,138 +1,138 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.propertytable.impl;
-
-import java.io.StringReader ;
-
-import org.apache.jena.atlas.csv.CSVParser ;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.NodeFactory ;
-import org.apache.jena.propertytable.BaseTest ;
-import org.apache.jena.propertytable.Row ;
-import org.junit.Assert ;
-import org.junit.Test ;
-
-
-/**
- * Tests related to PropertyTableBuilder, or more explicitly for the CSV parser in the current release.
- *
- */
-public abstract class AbstractPropertyTableBuilderTest extends BaseTest {
-
-	@Test
-	public void testFillPropertyTable() {
-		CSVParser iterator = csv("a,b\nc,d\ne,f");
-		PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
-
-		Assert.assertEquals(3, table.getColumns().size());
-		containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
-		containsColumn("a");
-		containsColumn("b");
-
-		Assert.assertEquals(2, table.getAllRows().size());
-		containsValue(0, "a", "c");
-		containsValue(0, "b", "d");
-
-		containsValue(1, "a", "e");
-		containsValue(1, "b", "f");
-
-	}
-
-	@Test
-	public void testIrregularTable1() {
-		CSVParser iterator = csv("a,b\nc\ne,f");
-		PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
-
-		Assert.assertEquals(3, table.getColumns().size());
-		containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
-		containsColumn("a");
-		containsColumn("b");
-
-		Assert.assertEquals(2, table.getAllRows().size());
-		containsValue(0, "a", "c");
-		nullValue(0, "b");
-
-		containsValue(1, "a", "e");
-		containsValue(1, "b", "f");
-	}
-
-	@Test
-	public void testIrregularTable2() {
-		CSVParser iterator = csv("a,b\nc,d1,d2\ne,f");
-		PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
-
-		Assert.assertEquals(3, table.getColumns().size());
-		containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
-		containsColumn("a");
-		containsColumn("b");
-
-		Assert.assertEquals(2, table.getAllRows().size());
-		containsValue(0, "a", "c");
-		containsValue(0, "b", "d1");
-
-		containsValue(1, "a", "e");
-		containsValue(1, "b", "f");
-	}
-
-	@Test
-	public void testIrregularTable3() {
-		CSVParser iterator = csv("a,b\n,d\ne,f");
-		PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
-
-		Assert.assertEquals(3, table.getColumns().size());
-		containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
-		containsColumn("a");
-		containsColumn("b");
-
-		Assert.assertEquals(2, table.getAllRows().size());
-		nullValue(0, "a");
-		containsValue(0, "b", "d");
-
-		containsValue(1, "a", "e");
-		containsValue(1, "b", "f");
-	}
-
-	private void nullValue(int rowIndex, String column) {
-		Row row = table.getAllRows().get(rowIndex);
-		Node v = row.getValue(NodeFactory.createURI(getColumnKey(column)));
-		Assert.assertEquals(null, v);
-	}
-
-	private void containsValue(int rowIndex, String column, String value) {
-		Row row = table.getAllRows().get(rowIndex);
-		Node v = row.getValue(NodeFactory.createURI(getColumnKey(column)));
-		Assert.assertEquals(value, v.getLiteralValue());
-	}
-
-	private String getColumnKey(String column) {
-		return PropertyTableBuilder.createColumnKeyURI(csvFilePath, column);
-	}
-
-	private void containsColumn(String column) {
-		containsColumn(NodeFactory.createURI(getColumnKey(column)));
-	}
-
-	private void containsColumn(Node columnKey) {
-		Assert.assertTrue(collectionContains(table.getColumns(), columnKey));
-	}
-
-	private CSVParser csv(String input) {
-	    return CSVParser.create(new StringReader(input));
-	}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.propertytable.impl;
+
+import java.io.StringReader ;
+
+import org.apache.jena.atlas.csv.CSVParser ;
+import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.NodeFactory ;
+import org.apache.jena.propertytable.BaseTest ;
+import org.apache.jena.propertytable.Row ;
+import org.junit.Assert ;
+import org.junit.Test ;
+
+
+/**
+ * Tests related to PropertyTableBuilder, or more explicitly for the CSV parser in the current release.
+ *
+ */
+public abstract class AbstractPropertyTableBuilderTest extends BaseTest {
+
+	@Test
+	public void testFillPropertyTable() {
+		CSVParser iterator = csv("a,b\nc,d\ne,f");
+		PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
+
+		Assert.assertEquals(3, table.getColumns().size());
+		containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
+		containsColumn("a");
+		containsColumn("b");
+
+		Assert.assertEquals(2, table.getAllRows().size());
+		containsValue(0, "a", "c");
+		containsValue(0, "b", "d");
+
+		containsValue(1, "a", "e");
+		containsValue(1, "b", "f");
+
+	}
+
+	@Test
+	public void testIrregularTable1() {
+		CSVParser iterator = csv("a,b\nc\ne,f");
+		PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
+
+		Assert.assertEquals(3, table.getColumns().size());
+		containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
+		containsColumn("a");
+		containsColumn("b");
+
+		Assert.assertEquals(2, table.getAllRows().size());
+		containsValue(0, "a", "c");
+		nullValue(0, "b");
+
+		containsValue(1, "a", "e");
+		containsValue(1, "b", "f");
+	}
+
+	@Test
+	public void testIrregularTable2() {
+		CSVParser iterator = csv("a,b\nc,d1,d2\ne,f");
+		PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
+
+		Assert.assertEquals(3, table.getColumns().size());
+		containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
+		containsColumn("a");
+		containsColumn("b");
+
+		Assert.assertEquals(2, table.getAllRows().size());
+		containsValue(0, "a", "c");
+		containsValue(0, "b", "d1");
+
+		containsValue(1, "a", "e");
+		containsValue(1, "b", "f");
+	}
+
+	@Test
+	public void testIrregularTable3() {
+		CSVParser iterator = csv("a,b\n,d\ne,f");
+		PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
+
+		Assert.assertEquals(3, table.getColumns().size());
+		containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
+		containsColumn("a");
+		containsColumn("b");
+
+		Assert.assertEquals(2, table.getAllRows().size());
+		nullValue(0, "a");
+		containsValue(0, "b", "d");
+
+		containsValue(1, "a", "e");
+		containsValue(1, "b", "f");
+	}
+
+	private void nullValue(int rowIndex, String column) {
+		Row row = table.getAllRows().get(rowIndex);
+		Node v = row.getValue(NodeFactory.createURI(getColumnKey(column)));
+		Assert.assertEquals(null, v);
+	}
+
+	private void containsValue(int rowIndex, String column, String value) {
+		Row row = table.getAllRows().get(rowIndex);
+		Node v = row.getValue(NodeFactory.createURI(getColumnKey(column)));
+		Assert.assertEquals(value, v.getLiteralValue());
+	}
+
+	private String getColumnKey(String column) {
+		return PropertyTableBuilder.createColumnKeyURI(csvFilePath, column);
+	}
+
+	private void containsColumn(String column) {
+		containsColumn(NodeFactory.createURI(getColumnKey(column)));
+	}
+
+	private void containsColumn(Node columnKey) {
+		Assert.assertTrue(collectionContains(table.getColumns(), columnKey));
+	}
+
+	private CSVParser csv(String input) {
+	    return CSVParser.create(new StringReader(input));
+	}
+}