http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/impl/ColumnImpl.java
----------------------------------------------------------------------
diff --cc 
jena-csv/src/main/java/org/apache/jena/propertytable/impl/ColumnImpl.java
index 808441a,808441a..ce456f9
--- a/jena-csv/src/main/java/org/apache/jena/propertytable/impl/ColumnImpl.java
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/impl/ColumnImpl.java
@@@ -1,57 -1,57 +1,57 @@@
--/*
-- * 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.List;
--
--import org.apache.jena.graph.Node ;
--import org.apache.jena.propertytable.Column;
--import org.apache.jena.propertytable.PropertyTable;
--
--/**
-- * The simple implementation of Column
-- *
-- */
--public class ColumnImpl implements Column {
--      
--      
--      private final PropertyTable table;
--      private Node p;
--
--      ColumnImpl(PropertyTable table, Node p) {
--              this.table = table;
--              this.p = p;
--      }
--
--      @Override
--      public PropertyTable getTable() {
--              return table;
--      }
--
--      @Override
--      public Node getColumnKey() {
--              return p;
--      }
--
--      @Override
--      public List<Node> getValues() {
--              return table.getColumnValues(this);
--      }
--}
++/*
++ * 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.List;
++
++import org.apache.jena.graph.Node ;
++import org.apache.jena.propertytable.Column;
++import org.apache.jena.propertytable.PropertyTable;
++
++/**
++ * The simple implementation of Column
++ *
++ */
++public class ColumnImpl implements Column {
++      
++      
++      private final PropertyTable table;
++      private Node p;
++
++      ColumnImpl(PropertyTable table, Node p) {
++              this.table = table;
++              this.p = p;
++      }
++
++      @Override
++      public PropertyTable getTable() {
++              return table;
++      }
++
++      @Override
++      public Node getColumnKey() {
++              return p;
++      }
++
++      @Override
++      public List<Node> getValues() {
++              return table.getColumnValues(this);
++      }
++}

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableArrayImpl.java
----------------------------------------------------------------------
diff --cc 
jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableArrayImpl.java
index 6b8bd6e,6b8bd6e..1920045
--- 
a/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableArrayImpl.java
+++ 
b/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableArrayImpl.java
@@@ -1,345 -1,345 +1,345 @@@
--/*
-- * 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.ArrayList;
--import java.util.Collection;
--import java.util.HashMap;
--import java.util.List;
--import java.util.Map;
--
--import org.apache.jena.atlas.iterator.Iter;
--import org.apache.jena.atlas.iterator.IteratorConcat;
--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.WrappedIterator ;
--
--/**
-- * A PropertyTable Implementation using a two dimension array.
-- * It contains SPO and PSO indexes.
-- * 
-- */
--public class PropertyTableArrayImpl implements PropertyTable {
--      
--      private final List<Node> rowList;
--      private final List<Node> columnList;
--
--      private final Map<Node, Integer> rowKeyToIndex;
--      private final Map<Node, Integer> columnKeyToIndex;
--      private final Node[][] array;
--      private final int rowNum;
--      private final int columnNum;
--      
--      public PropertyTableArrayImpl(int rowNum, int columnNum){
--              rowList = new ArrayList<Node>(rowNum);
--              columnList = new ArrayList<Node>(columnNum);
--              rowKeyToIndex = new HashMap<Node, Integer>();
--              columnKeyToIndex = new HashMap<Node, Integer>();
--              this.rowNum = rowNum;
--              this.columnNum = columnNum;
--              array = new Node [rowNum][columnNum];
--      }
--
--      @Override
--      public ExtendedIterator<Triple> getTripleIterator(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");
--              }
--              
--              ArrayList<Triple> triples = new ArrayList<Triple>();
--              
--              Node p = column.getColumnKey();
--              Integer columnIndex = this.columnKeyToIndex.get(p);
--              if (columnIndex != null){
--                      for(int rowIndex=0; rowIndex< 
rowList.size();rowIndex++){
--                              if ( value.equals( this.get(rowIndex, 
columnIndex))){
--                                      
triples.add(Triple.create(rowList.get(rowIndex), p, value));
--                              }
--                      }
--              }
--              return WrappedIterator.create(triples.iterator());
--      }
--
--      @Override
--      public ExtendedIterator<Triple> getTripleIterator(Column column) {
--              
--              if (column == null || column.getColumnKey() == null)
--                      throw new NullPointerException("column is null");
--              
--              ArrayList<Triple> triples = new ArrayList<Triple>();
--              
--              Node p = column.getColumnKey();
--              Integer columnIndex = this.columnKeyToIndex.get(p);
--              if (columnIndex != null){
--                      for(int rowIndex=0; rowIndex< 
rowList.size();rowIndex++){
--                              if(this.get(rowIndex, columnIndex)!=null){
--                                      
triples.add(Triple.create(rowList.get(rowIndex), p, this.get(rowIndex, 
columnIndex)));
--                              }
--                      }
--              }
--              return WrappedIterator.create(triples.iterator());
--      }
--
--      @Override
--      public ExtendedIterator<Triple> getTripleIterator(Node value) {
--              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(Row row) {
--              if (row == null || row.getRowKey() == null)
--                      throw new NullPointerException("row is null");
--              
--              ArrayList<Triple> triples = new ArrayList<Triple>();
--          Integer rowIndex = this.rowKeyToIndex.get(row.getRowKey());
--
--              if (rowIndex != null){
--                      for(int columnIndex=0; columnIndex < columnList.size(); 
columnIndex++){
--                              triples.add(Triple.create( row.getRowKey(), 
columnList.get(columnIndex), this.get(rowIndex, columnIndex)));
--                      }
--              }
--              return WrappedIterator.create(triples.iterator());
--      }
--
--      @Override
--      public ExtendedIterator<Triple> getTripleIterator() {
--
--              IteratorConcat<Triple> iter = new IteratorConcat<Triple>();
--              for (Column column : getColumns()) {
--                      iter.add(getTripleIterator(column));
--              }
--              return WrappedIterator.create(Iter.distinct(iter));
--      }
--
--      @Override
--      public Collection<Column> getColumns() {
--              Collection<Column> columns = new ArrayList<Column>();
--              for(Node p: columnKeyToIndex.keySet() ){
--                      columns.add(new ColumnImpl(this, p));
--              }
--              return columns;
--      }
--
--      @Override
--      public Column getColumn(Node p) {
--              if (p == null)
--                      throw new NullPointerException("column name is null");
--          Integer columnIndex = columnKeyToIndex.get(p);
--          return (columnIndex == null)
--              ? null : new ColumnImpl(this, p);
--      }
--
--      @Override
--      public Column createColumn(Node p) {
--              if (p == null)
--                      throw new NullPointerException("column name is null");
--
--              if (columnKeyToIndex.containsKey(p))
--                      throw new IllegalArgumentException("column already 
exists: '"
--                                      + p.toString());
--              
--              if (columnList.size()>= columnNum)
--                      throw new IllegalArgumentException("cannot create new 
column for max column count: " + columnNum);
--              
--              columnList.add(p);
--              columnKeyToIndex.put(p, columnList.indexOf(p));
--              return getColumn(p);
--      }
--
--      @Override
--      public Row getRow(Node s) {
--              if (s == null)
--                      throw new NullPointerException("subject node is null");
--              
--              Integer rowIndex = rowKeyToIndex.get(s);
--              return (rowIndex == null) ? null : new InternalRow(rowIndex);
--      }
--
--      @Override
--      public Row createRow(Node s) {
--              Row row = this.getRow(s);
--              if (row != null)
--                      return row;
--
--              if (rowList.size()>= rowNum)
--                      throw new IllegalArgumentException("cannot create new 
row for max row count: " + rowNum);
--              
--              rowList.add(s);
--              int rowIndex = rowList.indexOf(s);
--              rowKeyToIndex.put(s, rowIndex);         
--              
--              return new InternalRow(rowIndex);
--      }
--      
--      private void set(int rowIndex, int columnIndex, Node value) {
--              
--              if (rowIndex >= rowList.size())
--                      throw new IllegalArgumentException("row index out of 
bound: " + rowList.size());
--              if (columnIndex >= columnList.size())
--                      throw new IllegalArgumentException("column index out of 
bound: " + columnList.size());
--              array[rowIndex][columnIndex] = value;
--      }
--      
--      public Node get(int rowIndex, int columnIndex) {
--          if (rowIndex >= rowList.size())
--                      throw new IllegalArgumentException("row index out of 
bound: " + rowList.size());
--              if (columnIndex >= columnList.size())
--                      throw new IllegalArgumentException("column index out of 
bound: " + columnList.size());
--              return array[rowIndex][columnIndex];
--    }
--
--      @Override
--      public List<Row> getAllRows() {
--              ArrayList<Row> rows = new ArrayList<Row>();
--              for (int rowIndex=0;rowIndex<rowList.size();rowIndex++){
--                      rows.add( new InternalRow(rowIndex));
--              }
--              return rows;
--      }
--
--      @Override
--      public List<Node> getColumnValues(Column column) {
--              if (column == null || column.getColumnKey() == null)
--                      throw new NullPointerException("column is null");
--              
--              Node p = column.getColumnKey();
--              Integer columnIndex = this.columnKeyToIndex.get(p);
--              
--              List<Node> list = new ArrayList<Node>();
--              
--              if (columnIndex != null){
--                      for(int rowIndex=0; rowIndex< 
rowList.size();rowIndex++){
--                              if(this.get(rowIndex, columnIndex)!=null){
--                                      list.add(this.get(rowIndex, 
columnIndex));
--                              }
--                      }
--              }
--              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");
--              }
--              
--              final ArrayList<Row> matchingRows = new ArrayList<Row>();
--              
--              Node p = column.getColumnKey();
--              Integer columnIndex = this.columnKeyToIndex.get(p);
--              if (columnIndex != null){
--                      for(int rowIndex=0; rowIndex< 
rowList.size();rowIndex++){
--                              if ( value.equals( this.get(rowIndex, 
columnIndex))){
--                                      matchingRows.add( this.getRow( 
rowList.get(rowIndex) ));
--                              }
--                      }
--              }
--              return matchingRows;
--      }
--      
--      private final class InternalRow implements Row {
--
--          final int rowIndex;
--
--          InternalRow(int rowIndex) {
--            this.rowIndex = rowIndex;
--          }
--              
--              @Override
--              public PropertyTable getTable() {
--                      return PropertyTableArrayImpl.this;
--              }
--
--              @Override
--              public void setValue(Column column, Node value) {
--                      if (column == null || column.getColumnKey() == null)
--                              throw new NullPointerException("column is 
null");
--                      
--                  Integer columnIndex = 
columnKeyToIndex.get(column.getColumnKey());
--                  if (columnIndex == null)
--                      throw new IllegalArgumentException("column index does 
not exist: " + column.getColumnKey());
--
--                  set(rowIndex, columnIndex, value);
--                      
--              }
--
--              @Override
--              public Node getValue(Column column) {
--                      if (column == null)
--                              throw new NullPointerException("column is 
null");
--                      return this.getValue(column.getColumnKey());
--              }
--
--              @Override
--              public Node getValue(Node columnKey) {
--                      if (columnKey == null)
--                              throw new NullPointerException("column key is 
null");
--                      
--                  Integer columnIndex = columnKeyToIndex.get(columnKey);
--                  if (columnIndex == null)
--                      throw new IllegalArgumentException("column index does 
not exist: " + columnKey);
--                  
--                  return get(rowIndex, columnIndex);
--              }
--
--              @Override
--              public Node getRowKey() {
--                      return rowList.get(rowIndex);
--              }
--
--              @Override
--              public ExtendedIterator<Triple> getTripleIterator() {
--                      ArrayList<Triple> triples = new ArrayList<Triple>();
--                      for (int 
columnIndex=0;columnIndex<columnList.size();columnIndex++) {
--                              triples.add(Triple.create(getRowKey(), 
columnList.get(columnIndex), get(rowIndex, columnIndex)));
--                      }
--                      return WrappedIterator.create(triples.iterator());
--              }
--
--              @Override
--              public Collection<Column> getColumns() {
--                      return PropertyTableArrayImpl.this.getColumns();
--              }
--              
--      }
--
--
--
--
--}
++/*
++ * 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.ArrayList;
++import java.util.Collection;
++import java.util.HashMap;
++import java.util.List;
++import java.util.Map;
++
++import org.apache.jena.atlas.iterator.Iter;
++import org.apache.jena.atlas.iterator.IteratorConcat;
++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.WrappedIterator ;
++
++/**
++ * A PropertyTable Implementation using a two dimension array.
++ * It contains SPO and PSO indexes.
++ * 
++ */
++public class PropertyTableArrayImpl implements PropertyTable {
++      
++      private final List<Node> rowList;
++      private final List<Node> columnList;
++
++      private final Map<Node, Integer> rowKeyToIndex;
++      private final Map<Node, Integer> columnKeyToIndex;
++      private final Node[][] array;
++      private final int rowNum;
++      private final int columnNum;
++      
++      public PropertyTableArrayImpl(int rowNum, int columnNum){
++              rowList = new ArrayList<Node>(rowNum);
++              columnList = new ArrayList<Node>(columnNum);
++              rowKeyToIndex = new HashMap<Node, Integer>();
++              columnKeyToIndex = new HashMap<Node, Integer>();
++              this.rowNum = rowNum;
++              this.columnNum = columnNum;
++              array = new Node [rowNum][columnNum];
++      }
++
++      @Override
++      public ExtendedIterator<Triple> getTripleIterator(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");
++              }
++              
++              ArrayList<Triple> triples = new ArrayList<Triple>();
++              
++              Node p = column.getColumnKey();
++              Integer columnIndex = this.columnKeyToIndex.get(p);
++              if (columnIndex != null){
++                      for(int rowIndex=0; rowIndex< 
rowList.size();rowIndex++){
++                              if ( value.equals( this.get(rowIndex, 
columnIndex))){
++                                      
triples.add(Triple.create(rowList.get(rowIndex), p, value));
++                              }
++                      }
++              }
++              return WrappedIterator.create(triples.iterator());
++      }
++
++      @Override
++      public ExtendedIterator<Triple> getTripleIterator(Column column) {
++              
++              if (column == null || column.getColumnKey() == null)
++                      throw new NullPointerException("column is null");
++              
++              ArrayList<Triple> triples = new ArrayList<Triple>();
++              
++              Node p = column.getColumnKey();
++              Integer columnIndex = this.columnKeyToIndex.get(p);
++              if (columnIndex != null){
++                      for(int rowIndex=0; rowIndex< 
rowList.size();rowIndex++){
++                              if(this.get(rowIndex, columnIndex)!=null){
++                                      
triples.add(Triple.create(rowList.get(rowIndex), p, this.get(rowIndex, 
columnIndex)));
++                              }
++                      }
++              }
++              return WrappedIterator.create(triples.iterator());
++      }
++
++      @Override
++      public ExtendedIterator<Triple> getTripleIterator(Node value) {
++              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(Row row) {
++              if (row == null || row.getRowKey() == null)
++                      throw new NullPointerException("row is null");
++              
++              ArrayList<Triple> triples = new ArrayList<Triple>();
++          Integer rowIndex = this.rowKeyToIndex.get(row.getRowKey());
++
++              if (rowIndex != null){
++                      for(int columnIndex=0; columnIndex < columnList.size(); 
columnIndex++){
++                              triples.add(Triple.create( row.getRowKey(), 
columnList.get(columnIndex), this.get(rowIndex, columnIndex)));
++                      }
++              }
++              return WrappedIterator.create(triples.iterator());
++      }
++
++      @Override
++      public ExtendedIterator<Triple> getTripleIterator() {
++
++              IteratorConcat<Triple> iter = new IteratorConcat<Triple>();
++              for (Column column : getColumns()) {
++                      iter.add(getTripleIterator(column));
++              }
++              return WrappedIterator.create(Iter.distinct(iter));
++      }
++
++      @Override
++      public Collection<Column> getColumns() {
++              Collection<Column> columns = new ArrayList<Column>();
++              for(Node p: columnKeyToIndex.keySet() ){
++                      columns.add(new ColumnImpl(this, p));
++              }
++              return columns;
++      }
++
++      @Override
++      public Column getColumn(Node p) {
++              if (p == null)
++                      throw new NullPointerException("column name is null");
++          Integer columnIndex = columnKeyToIndex.get(p);
++          return (columnIndex == null)
++              ? null : new ColumnImpl(this, p);
++      }
++
++      @Override
++      public Column createColumn(Node p) {
++              if (p == null)
++                      throw new NullPointerException("column name is null");
++
++              if (columnKeyToIndex.containsKey(p))
++                      throw new IllegalArgumentException("column already 
exists: '"
++                                      + p.toString());
++              
++              if (columnList.size()>= columnNum)
++                      throw new IllegalArgumentException("cannot create new 
column for max column count: " + columnNum);
++              
++              columnList.add(p);
++              columnKeyToIndex.put(p, columnList.indexOf(p));
++              return getColumn(p);
++      }
++
++      @Override
++      public Row getRow(Node s) {
++              if (s == null)
++                      throw new NullPointerException("subject node is null");
++              
++              Integer rowIndex = rowKeyToIndex.get(s);
++              return (rowIndex == null) ? null : new InternalRow(rowIndex);
++      }
++
++      @Override
++      public Row createRow(Node s) {
++              Row row = this.getRow(s);
++              if (row != null)
++                      return row;
++
++              if (rowList.size()>= rowNum)
++                      throw new IllegalArgumentException("cannot create new 
row for max row count: " + rowNum);
++              
++              rowList.add(s);
++              int rowIndex = rowList.indexOf(s);
++              rowKeyToIndex.put(s, rowIndex);         
++              
++              return new InternalRow(rowIndex);
++      }
++      
++      private void set(int rowIndex, int columnIndex, Node value) {
++              
++              if (rowIndex >= rowList.size())
++                      throw new IllegalArgumentException("row index out of 
bound: " + rowList.size());
++              if (columnIndex >= columnList.size())
++                      throw new IllegalArgumentException("column index out of 
bound: " + columnList.size());
++              array[rowIndex][columnIndex] = value;
++      }
++      
++      public Node get(int rowIndex, int columnIndex) {
++          if (rowIndex >= rowList.size())
++                      throw new IllegalArgumentException("row index out of 
bound: " + rowList.size());
++              if (columnIndex >= columnList.size())
++                      throw new IllegalArgumentException("column index out of 
bound: " + columnList.size());
++              return array[rowIndex][columnIndex];
++    }
++
++      @Override
++      public List<Row> getAllRows() {
++              ArrayList<Row> rows = new ArrayList<Row>();
++              for (int rowIndex=0;rowIndex<rowList.size();rowIndex++){
++                      rows.add( new InternalRow(rowIndex));
++              }
++              return rows;
++      }
++
++      @Override
++      public List<Node> getColumnValues(Column column) {
++              if (column == null || column.getColumnKey() == null)
++                      throw new NullPointerException("column is null");
++              
++              Node p = column.getColumnKey();
++              Integer columnIndex = this.columnKeyToIndex.get(p);
++              
++              List<Node> list = new ArrayList<Node>();
++              
++              if (columnIndex != null){
++                      for(int rowIndex=0; rowIndex< 
rowList.size();rowIndex++){
++                              if(this.get(rowIndex, columnIndex)!=null){
++                                      list.add(this.get(rowIndex, 
columnIndex));
++                              }
++                      }
++              }
++              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");
++              }
++              
++              final ArrayList<Row> matchingRows = new ArrayList<Row>();
++              
++              Node p = column.getColumnKey();
++              Integer columnIndex = this.columnKeyToIndex.get(p);
++              if (columnIndex != null){
++                      for(int rowIndex=0; rowIndex< 
rowList.size();rowIndex++){
++                              if ( value.equals( this.get(rowIndex, 
columnIndex))){
++                                      matchingRows.add( this.getRow( 
rowList.get(rowIndex) ));
++                              }
++                      }
++              }
++              return matchingRows;
++      }
++      
++      private final class InternalRow implements Row {
++
++          final int rowIndex;
++
++          InternalRow(int rowIndex) {
++            this.rowIndex = rowIndex;
++          }
++              
++              @Override
++              public PropertyTable getTable() {
++                      return PropertyTableArrayImpl.this;
++              }
++
++              @Override
++              public void setValue(Column column, Node value) {
++                      if (column == null || column.getColumnKey() == null)
++                              throw new NullPointerException("column is 
null");
++                      
++                  Integer columnIndex = 
columnKeyToIndex.get(column.getColumnKey());
++                  if (columnIndex == null)
++                      throw new IllegalArgumentException("column index does 
not exist: " + column.getColumnKey());
++
++                  set(rowIndex, columnIndex, value);
++                      
++              }
++
++              @Override
++              public Node getValue(Column column) {
++                      if (column == null)
++                              throw new NullPointerException("column is 
null");
++                      return this.getValue(column.getColumnKey());
++              }
++
++              @Override
++              public Node getValue(Node columnKey) {
++                      if (columnKey == null)
++                              throw new NullPointerException("column key is 
null");
++                      
++                  Integer columnIndex = columnKeyToIndex.get(columnKey);
++                  if (columnIndex == null)
++                      throw new IllegalArgumentException("column index does 
not exist: " + columnKey);
++                  
++                  return get(rowIndex, columnIndex);
++              }
++
++              @Override
++              public Node getRowKey() {
++                      return rowList.get(rowIndex);
++              }
++
++              @Override
++              public ExtendedIterator<Triple> getTripleIterator() {
++                      ArrayList<Triple> triples = new ArrayList<Triple>();
++                      for (int 
columnIndex=0;columnIndex<columnList.size();columnIndex++) {
++                              triples.add(Triple.create(getRowKey(), 
columnList.get(columnIndex), get(rowIndex, columnIndex)));
++                      }
++                      return WrappedIterator.create(triples.iterator());
++              }
++
++              @Override
++              public Collection<Column> getColumns() {
++                      return PropertyTableArrayImpl.this.getColumns();
++              }
++              
++      }
++
++
++
++
++}

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableBuilder.java
----------------------------------------------------------------------
diff --cc 
jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableBuilder.java
index 0532dc9,0532dc9..a0c5af1
--- 
a/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableBuilder.java
+++ 
b/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableBuilder.java
@@@ -1,135 -1,135 +1,135 @@@
--/*
-- * 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.InputStream ;
--import java.util.ArrayList ;
--import java.util.Iterator ;
--import java.util.List ;
--
--import org.apache.jena.atlas.csv.CSVParser ;
--import org.apache.jena.atlas.io.IO ;
--import org.apache.jena.datatypes.xsd.XSDDatatype ;
--import org.apache.jena.graph.Node ;
--import org.apache.jena.graph.NodeFactory ;
--import org.apache.jena.propertytable.PropertyTable ;
--import org.apache.jena.propertytable.Row ;
--import org.apache.jena.propertytable.lang.LangCSV ;
--import org.apache.jena.riot.system.IRIResolver ;
--
--
--/**
-- * A tool for constructing PropertyTable from a file (e.g., a CSV file).
-- * 
-- *
-- */
--public class PropertyTableBuilder {
--      
--      public static Node CSV_ROW_NODE = 
NodeFactory.createURI(LangCSV.CSV_ROW);
--      
--      public static PropertyTable buildPropetyTableHashMapImplFromCsv(String 
csvFilePath) {           
--              PropertyTable table = new PropertyTableHashMapImpl();
--              return fillPropertyTable(table, csvFilePath);
--      }
--      
--      public static PropertyTable buildPropetyTableArrayImplFromCsv(String 
csvFilePath) {
--              PropertyTable table = 
createEmptyPropertyTableArrayImpl(csvFilePath);
--              return fillPropertyTable(table, csvFilePath);
--      }
--      
--      private static PropertyTable createEmptyPropertyTableArrayImpl (String 
csvFilePath) {
--              CSVParser parser = CSVParser.create(csvFilePath);
--              List<String> rowLine = null;
--              int rowNum = 0;
--              int columnNum = 0;
--              
--              while ((rowLine = parser.parse1()) != null) {
--                      if (rowNum == 0) {
--                              columnNum = rowLine.size();
--                      }
--                      rowNum++;
--              }
--              if (rowNum!=0 && columnNum!=0){
--                      return new PropertyTableArrayImpl(rowNum, columnNum+1);
--              } else {
--                      return null;
--              }
--      }
--
--      protected static PropertyTable fillPropertyTable(PropertyTable table, 
String csvFilePath ){
--              InputStream input = IO.openFile(csvFilePath) ;
--              CSVParser iterator = CSVParser.create(input) ;
--              return fillPropertyTable(table, iterator, csvFilePath);
--      }
--      
--      protected static PropertyTable fillPropertyTable(PropertyTable table, 
CSVParser parser, String csvFilePath){
--              if (table == null){
--                      return null;
--              }
--              ArrayList<Node> predicates = new ArrayList<Node>();
--              int rowNum = 0;
--              
--              Iterator<List<String>> iter = parser.iterator() ;
--              if ( ! iter.hasNext() )
--                  return table ;
--              List<String> row1 = iter.next() ;
--              table.createColumn(CSV_ROW_NODE);
--        for (String column : row1) {
--            String uri = createColumnKeyURI(csvFilePath, column);
--            Node p = NodeFactory.createURI(uri);
--            predicates.add(p);
--            table.createColumn(p);
--        }
--        
--        rowNum++ ;
--        while(iter.hasNext()) {
--            List<String> rowLine = iter.next();
--            Node subject = LangCSV.caculateSubject(rowNum, csvFilePath);
--            Row row = table.createRow(subject);
--
--            row.setValue(table.getColumn(CSV_ROW_NODE), 
--                         NodeFactory.createLiteral((rowNum + ""), 
XSDDatatype.XSDinteger));
--
--            for (int col = 0; col < rowLine.size() && col<predicates.size(); 
col++) {
--
--                String columnValue = rowLine.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);
--                }
--                row.setValue(table.getColumn(predicates.get(col)), o);
--            }
--            rowNum++ ;
--        }
--        return table;
--      }
--      
--      protected static String createColumnKeyURI(String csvFilePath, String 
column){
--              String uri = IRIResolver.resolveString(csvFilePath) + "#" + 
LangCSV.toSafeLocalname(column);
--              return uri;
--      }
--}
++/*
++ * 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.InputStream ;
++import java.util.ArrayList ;
++import java.util.Iterator ;
++import java.util.List ;
++
++import org.apache.jena.atlas.csv.CSVParser ;
++import org.apache.jena.atlas.io.IO ;
++import org.apache.jena.datatypes.xsd.XSDDatatype ;
++import org.apache.jena.graph.Node ;
++import org.apache.jena.graph.NodeFactory ;
++import org.apache.jena.propertytable.PropertyTable ;
++import org.apache.jena.propertytable.Row ;
++import org.apache.jena.propertytable.lang.LangCSV ;
++import org.apache.jena.riot.system.IRIResolver ;
++
++
++/**
++ * A tool for constructing PropertyTable from a file (e.g., a CSV file).
++ * 
++ *
++ */
++public class PropertyTableBuilder {
++      
++      public static Node CSV_ROW_NODE = 
NodeFactory.createURI(LangCSV.CSV_ROW);
++      
++      public static PropertyTable buildPropetyTableHashMapImplFromCsv(String 
csvFilePath) {           
++              PropertyTable table = new PropertyTableHashMapImpl();
++              return fillPropertyTable(table, csvFilePath);
++      }
++      
++      public static PropertyTable buildPropetyTableArrayImplFromCsv(String 
csvFilePath) {
++              PropertyTable table = 
createEmptyPropertyTableArrayImpl(csvFilePath);
++              return fillPropertyTable(table, csvFilePath);
++      }
++      
++      private static PropertyTable createEmptyPropertyTableArrayImpl (String 
csvFilePath) {
++              CSVParser parser = CSVParser.create(csvFilePath);
++              List<String> rowLine = null;
++              int rowNum = 0;
++              int columnNum = 0;
++              
++              while ((rowLine = parser.parse1()) != null) {
++                      if (rowNum == 0) {
++                              columnNum = rowLine.size();
++                      }
++                      rowNum++;
++              }
++              if (rowNum!=0 && columnNum!=0){
++                      return new PropertyTableArrayImpl(rowNum, columnNum+1);
++              } else {
++                      return null;
++              }
++      }
++
++      protected static PropertyTable fillPropertyTable(PropertyTable table, 
String csvFilePath ){
++              InputStream input = IO.openFile(csvFilePath) ;
++              CSVParser iterator = CSVParser.create(input) ;
++              return fillPropertyTable(table, iterator, csvFilePath);
++      }
++      
++      protected static PropertyTable fillPropertyTable(PropertyTable table, 
CSVParser parser, String csvFilePath){
++              if (table == null){
++                      return null;
++              }
++              ArrayList<Node> predicates = new ArrayList<Node>();
++              int rowNum = 0;
++              
++              Iterator<List<String>> iter = parser.iterator() ;
++              if ( ! iter.hasNext() )
++                  return table ;
++              List<String> row1 = iter.next() ;
++              table.createColumn(CSV_ROW_NODE);
++        for (String column : row1) {
++            String uri = createColumnKeyURI(csvFilePath, column);
++            Node p = NodeFactory.createURI(uri);
++            predicates.add(p);
++            table.createColumn(p);
++        }
++        
++        rowNum++ ;
++        while(iter.hasNext()) {
++            List<String> rowLine = iter.next();
++            Node subject = LangCSV.caculateSubject(rowNum, csvFilePath);
++            Row row = table.createRow(subject);
++
++            row.setValue(table.getColumn(CSV_ROW_NODE), 
++                         NodeFactory.createLiteral((rowNum + ""), 
XSDDatatype.XSDinteger));
++
++            for (int col = 0; col < rowLine.size() && col<predicates.size(); 
col++) {
++
++                String columnValue = rowLine.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);
++                }
++                row.setValue(table.getColumn(predicates.get(col)), o);
++            }
++            rowNum++ ;
++        }
++        return table;
++      }
++      
++      protected static String createColumnKeyURI(String csvFilePath, String 
column){
++              String uri = IRIResolver.resolveString(csvFilePath) + "#" + 
LangCSV.toSafeLocalname(column);
++              return uri;
++      }
++}

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImpl.java
----------------------------------------------------------------------
diff --cc 
jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImpl.java
index 622b3f1,622b3f1..45ec40f
--- 
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 +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/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/lang/LangCSV.java
----------------------------------------------------------------------
diff --cc jena-csv/src/main/java/org/apache/jena/propertytable/lang/LangCSV.java
index bd2ff29,bd2ff29..d816f46
--- 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 +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/4b5cd267/jena-csv/src/main/java/riotcmdx/csv2rdf.java
----------------------------------------------------------------------
diff --cc jena-csv/src/main/java/riotcmdx/csv2rdf.java
index eda3d8a,eda3d8a..cd8929d
--- a/jena-csv/src/main/java/riotcmdx/csv2rdf.java
+++ b/jena-csv/src/main/java/riotcmdx/csv2rdf.java
@@@ -1,52 -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/4b5cd267/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractColumnTest.java
----------------------------------------------------------------------
diff --cc 
jena-csv/src/test/java/org/apache/jena/propertytable/AbstractColumnTest.java
index a41161e,a41161e..fed4517
--- 
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 +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/4b5cd267/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractPropertyTableTest.java
----------------------------------------------------------------------
diff --cc 
jena-csv/src/test/java/org/apache/jena/propertytable/AbstractPropertyTableTest.java
index 5209361,5209361..a9544f9
--- 
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 +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);
++      }
++
++
++}

Reply via email to