You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2016/05/14 14:03:20 UTC
[21/42] jena git commit: Merge commit 'refs/pull/143/head' of
github.com:apache/jena
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractRowTest.java
----------------------------------------------------------------------
diff --cc jena-csv/src/test/java/org/apache/jena/propertytable/AbstractRowTest.java
index 3e16033,3e16033..20598a9
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractRowTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/AbstractRowTest.java
@@@ -1,105 -1,105 +1,105 @@@
--/*
-- * Licensed to the Apache Software Foundation (ASF) under one
-- * or more contributor license agreements. See the NOTICE file
-- * distributed with this work for additional information
-- * regarding copyright ownership. The ASF licenses this file
-- * to you under the Apache License, Version 2.0 (the
-- * "License"); you may not use this file except in compliance
-- * with the License. You may obtain a copy of the License at
-- *
-- * http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * Unless required by applicable law or agreed to in writing, software
-- * distributed under the License is distributed on an "AS IS" BASIS,
-- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- * See the License for the specific language governing permissions and
-- * limitations under the License.
-- */
--
--package org.apache.jena.propertytable;
--
--import org.apache.jena.graph.Node ;
--import org.apache.jena.graph.NodeFactory ;
--import org.junit.Assert;
--import org.junit.Test;
--
--/**
-- * Tests related to Row.
-- *
-- */
--public abstract class AbstractRowTest extends AbstractColumnTest{
--
-- @Test
-- public void testAddRowValue() {
--
-- Column something = table.createColumn(URI("something"));
-- Column somethingElse = table.createColumn(URI("somethingElse"));
--
-- row.setValue(something, URI("apple"));
-- row.setValue(somethingElse, URI("orange"));
--
-- Assert.assertEquals(URI("apple"), row.getValue(something));
-- Assert.assertEquals(URI("orange"), row.getValue(somethingElse));
-- }
--
-- @Test
-- public void testUnsetRowValue() {
-- Column something = table.createColumn(URI("something"));
-- row.setValue( something , URI("apple"));
-- Assert.assertEquals(URI("apple"), row.getValue(something));
-- row.setValue( something , null);
-- Assert.assertEquals(null, row.getValue(something));
-- }
--
-- @Test(expected=NullPointerException.class)
-- public void testGetRowWithNullKey() {
-- table.getRow(null);
-- }
--
-- @Test(expected = NullPointerException.class)
-- public void testAddValueToNotExistingColumn() {
-- row.setValue(table.getColumn(URI("something")), URI("apple"));
-- }
--
--
--
-- @Test(expected=IllegalArgumentException.class)
-- public void testGetListWithANonExistantColumn() {
-- Assert.assertNull(row.getValue( NodeFactory.createBlankNode() ));
-- }
--
-- @Test
-- public void testGetListWithAnMissingRowValue() {
-- Column something = table.createColumn(URI("something"));
-- Assert.assertNull(row.getValue(something));
-- }
--
-- @Test
-- public void testGetValue() {
-- Column something = table.createColumn(URI("something"));
-- row.setValue(something, URI("apple"));
-- Node value = row.getValue(something);
-- Assert.assertEquals(URI("apple"), value);
-- }
--
-- @Test
-- public void testRowExistsFalse(){
-- Assert.assertNull(table.getRow(NodeFactory.createBlankNode()));
-- }
--
-- @Test
-- public void testRowExistsTrue() {
-- Assert.assertNotNull(table.getRow(rowSubject));
-- }
--
-- @Test
-- public void testGetRowFalseAndDoesntCreateRow() {
-- Assert.assertNull(table.getRow(NodeFactory.createBlankNode()));
-- Assert.assertNull(table.getRow(NodeFactory.createBlankNode()));
-- }
--
-- @Test(expected=IllegalArgumentException.class)
-- public void testGetValueBeforeColumnExists() {
-- row.getValue(URI("nonexistentColumnX"));
-- }
--}
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++package org.apache.jena.propertytable;
++
++import org.apache.jena.graph.Node ;
++import org.apache.jena.graph.NodeFactory ;
++import org.junit.Assert;
++import org.junit.Test;
++
++/**
++ * Tests related to Row.
++ *
++ */
++public abstract class AbstractRowTest extends AbstractColumnTest{
++
++ @Test
++ public void testAddRowValue() {
++
++ Column something = table.createColumn(URI("something"));
++ Column somethingElse = table.createColumn(URI("somethingElse"));
++
++ row.setValue(something, URI("apple"));
++ row.setValue(somethingElse, URI("orange"));
++
++ Assert.assertEquals(URI("apple"), row.getValue(something));
++ Assert.assertEquals(URI("orange"), row.getValue(somethingElse));
++ }
++
++ @Test
++ public void testUnsetRowValue() {
++ Column something = table.createColumn(URI("something"));
++ row.setValue( something , URI("apple"));
++ Assert.assertEquals(URI("apple"), row.getValue(something));
++ row.setValue( something , null);
++ Assert.assertEquals(null, row.getValue(something));
++ }
++
++ @Test(expected=NullPointerException.class)
++ public void testGetRowWithNullKey() {
++ table.getRow(null);
++ }
++
++ @Test(expected = NullPointerException.class)
++ public void testAddValueToNotExistingColumn() {
++ row.setValue(table.getColumn(URI("something")), URI("apple"));
++ }
++
++
++
++ @Test(expected=IllegalArgumentException.class)
++ public void testGetListWithANonExistantColumn() {
++ Assert.assertNull(row.getValue( NodeFactory.createBlankNode() ));
++ }
++
++ @Test
++ public void testGetListWithAnMissingRowValue() {
++ Column something = table.createColumn(URI("something"));
++ Assert.assertNull(row.getValue(something));
++ }
++
++ @Test
++ public void testGetValue() {
++ Column something = table.createColumn(URI("something"));
++ row.setValue(something, URI("apple"));
++ Node value = row.getValue(something);
++ Assert.assertEquals(URI("apple"), value);
++ }
++
++ @Test
++ public void testRowExistsFalse(){
++ Assert.assertNull(table.getRow(NodeFactory.createBlankNode()));
++ }
++
++ @Test
++ public void testRowExistsTrue() {
++ Assert.assertNotNull(table.getRow(rowSubject));
++ }
++
++ @Test
++ public void testGetRowFalseAndDoesntCreateRow() {
++ Assert.assertNull(table.getRow(NodeFactory.createBlankNode()));
++ Assert.assertNull(table.getRow(NodeFactory.createBlankNode()));
++ }
++
++ @Test(expected=IllegalArgumentException.class)
++ public void testGetValueBeforeColumnExists() {
++ row.getValue(URI("nonexistentColumnX"));
++ }
++}
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/test/java/org/apache/jena/propertytable/BaseTest.java
----------------------------------------------------------------------
diff --cc jena-csv/src/test/java/org/apache/jena/propertytable/BaseTest.java
index 8e36236,8e36236..f0f6093
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/BaseTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/BaseTest.java
@@@ -1,47 -1,47 +1,47 @@@
--/*
-- * Licensed to the Apache Software Foundation (ASF) under one
-- * or more contributor license agreements. See the NOTICE file
-- * distributed with this work for additional information
-- * regarding copyright ownership. The ASF licenses this file
-- * to you under the Apache License, Version 2.0 (the
-- * "License"); you may not use this file except in compliance
-- * with the License. You may obtain a copy of the License at
-- *
-- * http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * Unless required by applicable law or agreed to in writing, software
-- * distributed under the License is distributed on an "AS IS" BASIS,
-- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- * See the License for the specific language governing permissions and
-- * limitations under the License.
-- */
--
--package org.apache.jena.propertytable;
--
--import java.util.Collection;
--
--import org.apache.jena.graph.Node ;
--import org.apache.jena.graph.NodeFactory ;
--
--public abstract class BaseTest {
-- protected PropertyTable table;
-- protected PropertyTable table2;
-- protected Row row;
-- private static final String ns = "eh:foo/bar#";
-- protected static final Node rowSubject = URI("rowSubject");
-- protected static final String csvFilePath = "src/test/resources/test.csv";
--
--
-- protected static Node URI(String localName) {
-- return NodeFactory.createURI(ns + localName);
-- }
--
-- protected static boolean collectionContains(
-- final Collection<Column> columns, final Node columnkey) {
-- for (final Column column : columns) {
-- if (column.getColumnKey().equals(columnkey))
-- return true;
-- }
-- return false;
-- }
--}
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++package org.apache.jena.propertytable;
++
++import java.util.Collection;
++
++import org.apache.jena.graph.Node ;
++import org.apache.jena.graph.NodeFactory ;
++
++public abstract class BaseTest {
++ protected PropertyTable table;
++ protected PropertyTable table2;
++ protected Row row;
++ private static final String ns = "eh:foo/bar#";
++ protected static final Node rowSubject = URI("rowSubject");
++ protected static final String csvFilePath = "src/test/resources/test.csv";
++
++
++ protected static Node URI(String localName) {
++ return NodeFactory.createURI(ns + localName);
++ }
++
++ protected static boolean collectionContains(
++ final Collection<Column> columns, final Node columnkey) {
++ for (final Column column : columns) {
++ if (column.getColumnKey().equals(columnkey))
++ return true;
++ }
++ return false;
++ }
++}
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/test/java/org/apache/jena/propertytable/TS_PropertyTable.java
----------------------------------------------------------------------
diff --cc jena-csv/src/test/java/org/apache/jena/propertytable/TS_PropertyTable.java
index 084365d,084365d..d6a0d2a
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/TS_PropertyTable.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/TS_PropertyTable.java
@@@ -1,42 -1,42 +1,42 @@@
--/*
-- * Licensed to the Apache Software Foundation (ASF) under one
-- * or more contributor license agreements. See the NOTICE file
-- * distributed with this work for additional information
-- * regarding copyright ownership. The ASF licenses this file
-- * to you under the Apache License, Version 2.0 (the
-- * "License"); you may not use this file except in compliance
-- * with the License. You may obtain a copy of the License at
-- *
-- * http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * Unless required by applicable law or agreed to in writing, software
-- * distributed under the License is distributed on an "AS IS" BASIS,
-- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- * See the License for the specific language governing permissions and
-- * limitations under the License.
-- */
--
--package org.apache.jena.propertytable;
--
--import org.apache.jena.propertytable.graph.GraphCSVTest;
--import org.apache.jena.propertytable.impl.PropertyTableArrayImplTest;
--import org.apache.jena.propertytable.impl.PropertyTableBuilderForArrayImplTest;
--import org.apache.jena.propertytable.impl.PropertyTableBuilderForHashMapImplTest;
--import org.apache.jena.propertytable.impl.PropertyTableHashMapImplTest;
--import org.apache.jena.propertytable.lang.TestLangCSV;
--import org.junit.runner.RunWith;
--import org.junit.runners.Suite;
--
--
--@RunWith(Suite.class)
--@Suite.SuiteClasses( {
-- PropertyTableArrayImplTest.class,
-- PropertyTableHashMapImplTest.class,
-- GraphCSVTest.class,
-- PropertyTableBuilderForArrayImplTest.class,
-- PropertyTableBuilderForHashMapImplTest.class,
-- TestLangCSV.class
--})
--public class TS_PropertyTable {
--
--}
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++package org.apache.jena.propertytable;
++
++import org.apache.jena.propertytable.graph.GraphCSVTest;
++import org.apache.jena.propertytable.impl.PropertyTableArrayImplTest;
++import org.apache.jena.propertytable.impl.PropertyTableBuilderForArrayImplTest;
++import org.apache.jena.propertytable.impl.PropertyTableBuilderForHashMapImplTest;
++import org.apache.jena.propertytable.impl.PropertyTableHashMapImplTest;
++import org.apache.jena.propertytable.lang.TestLangCSV;
++import org.junit.runner.RunWith;
++import org.junit.runners.Suite;
++
++
++@RunWith(Suite.class)
++@Suite.SuiteClasses( {
++ PropertyTableArrayImplTest.class,
++ PropertyTableHashMapImplTest.class,
++ GraphCSVTest.class,
++ PropertyTableBuilderForArrayImplTest.class,
++ PropertyTableBuilderForHashMapImplTest.class,
++ TestLangCSV.class
++})
++public class TS_PropertyTable {
++
++}
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/test/java/org/apache/jena/propertytable/graph/GraphCSVTest.java
----------------------------------------------------------------------
diff --cc jena-csv/src/test/java/org/apache/jena/propertytable/graph/GraphCSVTest.java
index b81f37f,b81f37f..2534287
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/graph/GraphCSVTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/graph/GraphCSVTest.java
@@@ -1,154 -1,154 +1,154 @@@
--/*
-- * Licensed to the Apache Software Foundation (ASF) under one
-- * or more contributor license agreements. See the NOTICE file
-- * distributed with this work for additional information
-- * regarding copyright ownership. The ASF licenses this file
-- * to you under the Apache License, Version 2.0 (the
-- * "License"); you may not use this file except in compliance
-- * with the License. You may obtain a copy of the License at
-- *
-- * http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * Unless required by applicable law or agreed to in writing, software
-- * distributed under the License is distributed on an "AS IS" BASIS,
-- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- * See the License for the specific language governing permissions and
-- * limitations under the License.
-- */
--
--package org.apache.jena.propertytable.graph;
--
--import org.apache.jena.atlas.lib.StrUtils ;
--import org.apache.jena.propertytable.lang.CSV2RDF ;
--import org.apache.jena.query.* ;
--import org.apache.jena.rdf.model.Model ;
--import org.apache.jena.rdf.model.ModelFactory ;
--import org.apache.jena.sparql.engine.main.StageBuilder ;
--import org.apache.jena.sparql.engine.main.StageGenerator ;
--import org.junit.Assert ;
--import org.junit.BeforeClass ;
--import org.junit.Test ;
--
--/**
-- * Tests related to GraphCSV with some real world data.
-- */
--public class GraphCSVTest extends Assert {
--
-- @BeforeClass
-- public static void init(){
-- CSV2RDF.init() ;
-- }
--
-- @Test
-- public void testGraphCSV() {
-- //String file = "src/test/resources/HEFCE_organogram_senior_data_31032011.csv";test.csv
-- String file = "src/test/resources/test.csv";
--
-- Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
-- assertEquals(12, csv.size());
--
-- Query query = QueryFactory
-- .create("PREFIX : <src/test/resources/test.csv#> SELECT ?townName ?pop {?x :Town ?townName ; :Population ?pop ; :Predicate%20With%20Space 'PredicateWithSpace2' . FILTER(?pop > 500000)}");
--
-- QueryExecution qexec = QueryExecutionFactory.create(query, csv);
-- ResultSet results = qexec.execSelect();
--
-- assertTrue(results.hasNext());
-- QuerySolution soln = results.nextSolution();
-- assertEquals( "Northville", soln.getLiteral("townName").getString());
-- assertTrue( 654000 == soln.getLiteral("pop").getInt());
--
-- assertFalse(results.hasNext());
-- }
--
-- @Test
-- public void stageGeneratorTest(){
-- wireIntoExecution();
-- testGraphCSV();
-- }
--
-- private static void wireIntoExecution() {
-- StageGenerator orig = (StageGenerator)ARQ.getContext().get(ARQ.stageGenerator) ;
-- StageGenerator stageGenerator = new StageGeneratorPropertyTable(orig) ;
-- StageBuilder.setGenerator(ARQ.getContext(), stageGenerator) ;
-- }
--
-- //http://www.w3.org/TR/csvw-ucr/#UC-OrganogramData
-- //2.4 Use Case #4 - Publication of public sector roles and salaries
-- @Test
-- public void testUseCase4(){
-- String file = "src/test/resources/HEFCE_organogram_senior_data_31032011.csv";
--
-- Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
-- assertEquals(72, csv.size());
--
-- String x = StrUtils.strjoinNL
-- ("PREFIX : <src/test/resources/HEFCE_organogram_senior_data_31032011.csv#>"
-- ,"SELECT ?name ?unit"
-- ,"{ ?x :Name ?name ;"
-- ," :Unit ?unit ;"
-- ," :Actual%20Pay%20Floor%20%28%A3%29 ?floor ;"
-- ," :Actual%20Pay%20Ceiling%20%28%A3%29 ?ceiling ."
-- ,"FILTER(?floor > 100000 && ?ceiling <120000 )"
-- ,"}");
--
-- Query query = QueryFactory.create(x) ;
--
-- QueryExecution qexec = QueryExecutionFactory.create(query, csv);
-- ResultSet results = qexec.execSelect();
--
-- assertTrue(results.hasNext());
-- QuerySolution soln = results.nextSolution();
-- assertEquals( "David Sweeney", soln.getLiteral("name").getString());
-- assertEquals( "Research, Innovation and Skills", soln.getLiteral("unit").getString());
--
-- assertFalse(results.hasNext());
-- }
--
--
-- //http://www.w3.org/TR/csvw-ucr/#UC-JournalArticleSearch
-- //2.6 Use Case #6 - Journal Article Solr Search Results
-- @Test
-- public void testUseCase6(){
-- String file = "src/test/resources/PLOSone-search-results.csv";
--
-- Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
-- assertEquals(30, csv.size());
--
-- Query query = QueryFactory
-- .create("PREFIX : <src/test/resources/PLOSone-search-results.csv#> SELECT ?author {?x :author ?author ; :doi '10.1371/journal.pone.0095156' }");
--
-- QueryExecution qexec = QueryExecutionFactory.create(query, csv);
-- ResultSet results = qexec.execSelect();
--
-- assertTrue(results.hasNext());
-- QuerySolution soln = results.nextSolution();
-- assertEquals( "Oshrat Raz,Dorit L Lev,Alexander Battler,Eli I Lev", soln.getLiteral("author").getString());
--
-- assertFalse(results.hasNext());
-- }
--
-- //http://www.w3.org/TR/csvw-ucr/#UC-PaloAltoTreeData
-- //2.11 Use Case #11 - City of Palo Alto Tree Data
-- @Test
-- public void testUseCase11(){
-- String file = "src/test/resources/Palo_Alto_Trees.csv";
--
-- Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
-- assertEquals(199, csv.size());
--
-- Query query = QueryFactory
-- .create("PREFIX : <src/test/resources/Palo_Alto_Trees.csv#> SELECT ?longitude ?latitude {?x :Longitude ?longitude ; :Latitude ?latitude ; :Distance%20from%20Property ?distance . FILTER(?distance > 50 )}");
--
-- QueryExecution qexec = QueryExecutionFactory.create(query, csv);
-- ResultSet results = qexec.execSelect();
--
-- assertTrue(results.hasNext());
-- QuerySolution soln = results.nextSolution();
-- assertEquals( -122.1566921, soln.getLiteral("longitude").getDouble(), 0);
-- assertEquals( 37.4408948, soln.getLiteral("latitude").getDouble(), 0);
--
-- assertFalse(results.hasNext());
-- }
--
--}
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++package org.apache.jena.propertytable.graph;
++
++import org.apache.jena.atlas.lib.StrUtils ;
++import org.apache.jena.propertytable.lang.CSV2RDF ;
++import org.apache.jena.query.* ;
++import org.apache.jena.rdf.model.Model ;
++import org.apache.jena.rdf.model.ModelFactory ;
++import org.apache.jena.sparql.engine.main.StageBuilder ;
++import org.apache.jena.sparql.engine.main.StageGenerator ;
++import org.junit.Assert ;
++import org.junit.BeforeClass ;
++import org.junit.Test ;
++
++/**
++ * Tests related to GraphCSV with some real world data.
++ */
++public class GraphCSVTest extends Assert {
++
++ @BeforeClass
++ public static void init(){
++ CSV2RDF.init() ;
++ }
++
++ @Test
++ public void testGraphCSV() {
++ //String file = "src/test/resources/HEFCE_organogram_senior_data_31032011.csv";test.csv
++ String file = "src/test/resources/test.csv";
++
++ Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
++ assertEquals(12, csv.size());
++
++ Query query = QueryFactory
++ .create("PREFIX : <src/test/resources/test.csv#> SELECT ?townName ?pop {?x :Town ?townName ; :Population ?pop ; :Predicate%20With%20Space 'PredicateWithSpace2' . FILTER(?pop > 500000)}");
++
++ QueryExecution qexec = QueryExecutionFactory.create(query, csv);
++ ResultSet results = qexec.execSelect();
++
++ assertTrue(results.hasNext());
++ QuerySolution soln = results.nextSolution();
++ assertEquals( "Northville", soln.getLiteral("townName").getString());
++ assertTrue( 654000 == soln.getLiteral("pop").getInt());
++
++ assertFalse(results.hasNext());
++ }
++
++ @Test
++ public void stageGeneratorTest(){
++ wireIntoExecution();
++ testGraphCSV();
++ }
++
++ private static void wireIntoExecution() {
++ StageGenerator orig = (StageGenerator)ARQ.getContext().get(ARQ.stageGenerator) ;
++ StageGenerator stageGenerator = new StageGeneratorPropertyTable(orig) ;
++ StageBuilder.setGenerator(ARQ.getContext(), stageGenerator) ;
++ }
++
++ //http://www.w3.org/TR/csvw-ucr/#UC-OrganogramData
++ //2.4 Use Case #4 - Publication of public sector roles and salaries
++ @Test
++ public void testUseCase4(){
++ String file = "src/test/resources/HEFCE_organogram_senior_data_31032011.csv";
++
++ Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
++ assertEquals(72, csv.size());
++
++ String x = StrUtils.strjoinNL
++ ("PREFIX : <src/test/resources/HEFCE_organogram_senior_data_31032011.csv#>"
++ ,"SELECT ?name ?unit"
++ ,"{ ?x :Name ?name ;"
++ ," :Unit ?unit ;"
++ ," :Actual%20Pay%20Floor%20%28%A3%29 ?floor ;"
++ ," :Actual%20Pay%20Ceiling%20%28%A3%29 ?ceiling ."
++ ,"FILTER(?floor > 100000 && ?ceiling <120000 )"
++ ,"}");
++
++ Query query = QueryFactory.create(x) ;
++
++ QueryExecution qexec = QueryExecutionFactory.create(query, csv);
++ ResultSet results = qexec.execSelect();
++
++ assertTrue(results.hasNext());
++ QuerySolution soln = results.nextSolution();
++ assertEquals( "David Sweeney", soln.getLiteral("name").getString());
++ assertEquals( "Research, Innovation and Skills", soln.getLiteral("unit").getString());
++
++ assertFalse(results.hasNext());
++ }
++
++
++ //http://www.w3.org/TR/csvw-ucr/#UC-JournalArticleSearch
++ //2.6 Use Case #6 - Journal Article Solr Search Results
++ @Test
++ public void testUseCase6(){
++ String file = "src/test/resources/PLOSone-search-results.csv";
++
++ Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
++ assertEquals(30, csv.size());
++
++ Query query = QueryFactory
++ .create("PREFIX : <src/test/resources/PLOSone-search-results.csv#> SELECT ?author {?x :author ?author ; :doi '10.1371/journal.pone.0095156' }");
++
++ QueryExecution qexec = QueryExecutionFactory.create(query, csv);
++ ResultSet results = qexec.execSelect();
++
++ assertTrue(results.hasNext());
++ QuerySolution soln = results.nextSolution();
++ assertEquals( "Oshrat Raz,Dorit L Lev,Alexander Battler,Eli I Lev", soln.getLiteral("author").getString());
++
++ assertFalse(results.hasNext());
++ }
++
++ //http://www.w3.org/TR/csvw-ucr/#UC-PaloAltoTreeData
++ //2.11 Use Case #11 - City of Palo Alto Tree Data
++ @Test
++ public void testUseCase11(){
++ String file = "src/test/resources/Palo_Alto_Trees.csv";
++
++ Model csv = ModelFactory.createModelForGraph(new GraphCSV(file));
++ assertEquals(199, csv.size());
++
++ Query query = QueryFactory
++ .create("PREFIX : <src/test/resources/Palo_Alto_Trees.csv#> SELECT ?longitude ?latitude {?x :Longitude ?longitude ; :Latitude ?latitude ; :Distance%20from%20Property ?distance . FILTER(?distance > 50 )}");
++
++ QueryExecution qexec = QueryExecutionFactory.create(query, csv);
++ ResultSet results = qexec.execSelect();
++
++ assertTrue(results.hasNext());
++ QuerySolution soln = results.nextSolution();
++ assertEquals( -122.1566921, soln.getLiteral("longitude").getDouble(), 0);
++ assertEquals( 37.4408948, soln.getLiteral("latitude").getDouble(), 0);
++
++ assertFalse(results.hasNext());
++ }
++
++}
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/test/java/org/apache/jena/propertytable/impl/AbstractPropertyTableBuilderTest.java
----------------------------------------------------------------------
diff --cc jena-csv/src/test/java/org/apache/jena/propertytable/impl/AbstractPropertyTableBuilderTest.java
index a00d3fd,a00d3fd..9100096
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/impl/AbstractPropertyTableBuilderTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/impl/AbstractPropertyTableBuilderTest.java
@@@ -1,138 -1,138 +1,138 @@@
--/*
-- * Licensed to the Apache Software Foundation (ASF) under one
-- * or more contributor license agreements. See the NOTICE file
-- * distributed with this work for additional information
-- * regarding copyright ownership. The ASF licenses this file
-- * to you under the Apache License, Version 2.0 (the
-- * "License"); you may not use this file except in compliance
-- * with the License. You may obtain a copy of the License at
-- *
-- * http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * Unless required by applicable law or agreed to in writing, software
-- * distributed under the License is distributed on an "AS IS" BASIS,
-- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- * See the License for the specific language governing permissions and
-- * limitations under the License.
-- */
--
--package org.apache.jena.propertytable.impl;
--
--import java.io.StringReader ;
--
--import org.apache.jena.atlas.csv.CSVParser ;
--import org.apache.jena.graph.Node ;
--import org.apache.jena.graph.NodeFactory ;
--import org.apache.jena.propertytable.BaseTest ;
--import org.apache.jena.propertytable.Row ;
--import org.junit.Assert ;
--import org.junit.Test ;
--
--
--/**
-- * Tests related to PropertyTableBuilder, or more explicitly for the CSV parser in the current release.
-- *
-- */
--public abstract class AbstractPropertyTableBuilderTest extends BaseTest {
--
-- @Test
-- public void testFillPropertyTable() {
-- CSVParser iterator = csv("a,b\nc,d\ne,f");
-- PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
--
-- Assert.assertEquals(3, table.getColumns().size());
-- containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
-- containsColumn("a");
-- containsColumn("b");
--
-- Assert.assertEquals(2, table.getAllRows().size());
-- containsValue(0, "a", "c");
-- containsValue(0, "b", "d");
--
-- containsValue(1, "a", "e");
-- containsValue(1, "b", "f");
--
-- }
--
-- @Test
-- public void testIrregularTable1() {
-- CSVParser iterator = csv("a,b\nc\ne,f");
-- PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
--
-- Assert.assertEquals(3, table.getColumns().size());
-- containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
-- containsColumn("a");
-- containsColumn("b");
--
-- Assert.assertEquals(2, table.getAllRows().size());
-- containsValue(0, "a", "c");
-- nullValue(0, "b");
--
-- containsValue(1, "a", "e");
-- containsValue(1, "b", "f");
-- }
--
-- @Test
-- public void testIrregularTable2() {
-- CSVParser iterator = csv("a,b\nc,d1,d2\ne,f");
-- PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
--
-- Assert.assertEquals(3, table.getColumns().size());
-- containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
-- containsColumn("a");
-- containsColumn("b");
--
-- Assert.assertEquals(2, table.getAllRows().size());
-- containsValue(0, "a", "c");
-- containsValue(0, "b", "d1");
--
-- containsValue(1, "a", "e");
-- containsValue(1, "b", "f");
-- }
--
-- @Test
-- public void testIrregularTable3() {
-- CSVParser iterator = csv("a,b\n,d\ne,f");
-- PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
--
-- Assert.assertEquals(3, table.getColumns().size());
-- containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
-- containsColumn("a");
-- containsColumn("b");
--
-- Assert.assertEquals(2, table.getAllRows().size());
-- nullValue(0, "a");
-- containsValue(0, "b", "d");
--
-- containsValue(1, "a", "e");
-- containsValue(1, "b", "f");
-- }
--
-- private void nullValue(int rowIndex, String column) {
-- Row row = table.getAllRows().get(rowIndex);
-- Node v = row.getValue(NodeFactory.createURI(getColumnKey(column)));
-- Assert.assertEquals(null, v);
-- }
--
-- private void containsValue(int rowIndex, String column, String value) {
-- Row row = table.getAllRows().get(rowIndex);
-- Node v = row.getValue(NodeFactory.createURI(getColumnKey(column)));
-- Assert.assertEquals(value, v.getLiteralValue());
-- }
--
-- private String getColumnKey(String column) {
-- return PropertyTableBuilder.createColumnKeyURI(csvFilePath, column);
-- }
--
-- private void containsColumn(String column) {
-- containsColumn(NodeFactory.createURI(getColumnKey(column)));
-- }
--
-- private void containsColumn(Node columnKey) {
-- Assert.assertTrue(collectionContains(table.getColumns(), columnKey));
-- }
--
-- private CSVParser csv(String input) {
-- return CSVParser.create(new StringReader(input));
-- }
--}
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++package org.apache.jena.propertytable.impl;
++
++import java.io.StringReader ;
++
++import org.apache.jena.atlas.csv.CSVParser ;
++import org.apache.jena.graph.Node ;
++import org.apache.jena.graph.NodeFactory ;
++import org.apache.jena.propertytable.BaseTest ;
++import org.apache.jena.propertytable.Row ;
++import org.junit.Assert ;
++import org.junit.Test ;
++
++
++/**
++ * Tests related to PropertyTableBuilder, or more explicitly for the CSV parser in the current release.
++ *
++ */
++public abstract class AbstractPropertyTableBuilderTest extends BaseTest {
++
++ @Test
++ public void testFillPropertyTable() {
++ CSVParser iterator = csv("a,b\nc,d\ne,f");
++ PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
++
++ Assert.assertEquals(3, table.getColumns().size());
++ containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
++ containsColumn("a");
++ containsColumn("b");
++
++ Assert.assertEquals(2, table.getAllRows().size());
++ containsValue(0, "a", "c");
++ containsValue(0, "b", "d");
++
++ containsValue(1, "a", "e");
++ containsValue(1, "b", "f");
++
++ }
++
++ @Test
++ public void testIrregularTable1() {
++ CSVParser iterator = csv("a,b\nc\ne,f");
++ PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
++
++ Assert.assertEquals(3, table.getColumns().size());
++ containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
++ containsColumn("a");
++ containsColumn("b");
++
++ Assert.assertEquals(2, table.getAllRows().size());
++ containsValue(0, "a", "c");
++ nullValue(0, "b");
++
++ containsValue(1, "a", "e");
++ containsValue(1, "b", "f");
++ }
++
++ @Test
++ public void testIrregularTable2() {
++ CSVParser iterator = csv("a,b\nc,d1,d2\ne,f");
++ PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
++
++ Assert.assertEquals(3, table.getColumns().size());
++ containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
++ containsColumn("a");
++ containsColumn("b");
++
++ Assert.assertEquals(2, table.getAllRows().size());
++ containsValue(0, "a", "c");
++ containsValue(0, "b", "d1");
++
++ containsValue(1, "a", "e");
++ containsValue(1, "b", "f");
++ }
++
++ @Test
++ public void testIrregularTable3() {
++ CSVParser iterator = csv("a,b\n,d\ne,f");
++ PropertyTableBuilder.fillPropertyTable(table, iterator, csvFilePath);
++
++ Assert.assertEquals(3, table.getColumns().size());
++ containsColumn(PropertyTableBuilder.CSV_ROW_NODE);
++ containsColumn("a");
++ containsColumn("b");
++
++ Assert.assertEquals(2, table.getAllRows().size());
++ nullValue(0, "a");
++ containsValue(0, "b", "d");
++
++ containsValue(1, "a", "e");
++ containsValue(1, "b", "f");
++ }
++
++ private void nullValue(int rowIndex, String column) {
++ Row row = table.getAllRows().get(rowIndex);
++ Node v = row.getValue(NodeFactory.createURI(getColumnKey(column)));
++ Assert.assertEquals(null, v);
++ }
++
++ private void containsValue(int rowIndex, String column, String value) {
++ Row row = table.getAllRows().get(rowIndex);
++ Node v = row.getValue(NodeFactory.createURI(getColumnKey(column)));
++ Assert.assertEquals(value, v.getLiteralValue());
++ }
++
++ private String getColumnKey(String column) {
++ return PropertyTableBuilder.createColumnKeyURI(csvFilePath, column);
++ }
++
++ private void containsColumn(String column) {
++ containsColumn(NodeFactory.createURI(getColumnKey(column)));
++ }
++
++ private void containsColumn(Node columnKey) {
++ Assert.assertTrue(collectionContains(table.getColumns(), columnKey));
++ }
++
++ private CSVParser csv(String input) {
++ return CSVParser.create(new StringReader(input));
++ }
++}
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableArrayImplTest.java
----------------------------------------------------------------------
diff --cc jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableArrayImplTest.java
index ba1ca2d,ba1ca2d..fe5fa55
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableArrayImplTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableArrayImplTest.java
@@@ -1,84 -1,84 +1,84 @@@
--/*
-- * 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 org.apache.jena.propertytable.AbstractPropertyTableTest;
--import org.junit.After;
--import org.junit.Assert;
--import org.junit.Before;
--import org.junit.Test;
--
--/**
-- * Tests for PropertyTableArrayImpl
-- *
-- */
--public class PropertyTableArrayImplTest extends AbstractPropertyTableTest{
--
-- private static int rowNum = 10;
-- private static int columnNum = 10 ;
--
-- @Before
-- public void setUp() {
-- table = new PropertyTableArrayImpl(rowNum, columnNum);
-- table2 = new PropertyTableArrayImpl(rowNum, columnNum);
-- row = table.createRow(rowSubject);
--
-- }
--
-- @After
-- public void tearDown() {
-- table = null;
-- table2 = null;
-- row = null;
-- }
--
-- @Test
-- public void testColumnOutofBounds1() {
-- for (int i=0;i<columnNum;i++){
-- table.createColumn(URI("something_"+i));
-- }
-- Assert.assertEquals(columnNum, table.getColumns().size());
-- }
--
-- @Test(expected = IllegalArgumentException.class)
-- public void testColumnOutofBounds2() {
-- for (int i=0;i<columnNum+1;i++){
-- table.createColumn(URI("something_"+i));
-- }
-- }
--
-- @Test
-- public void testRowOutofBounds1() {
--
-- // we've already created a new Row in @Before
-- for (int i=0;i<rowNum-1;i++){
-- table.createRow(URI("something_"+i));
-- }
-- Assert.assertEquals(rowNum, table.getAllRows().size());
-- }
--
-- @Test(expected = IllegalArgumentException.class)
-- public void testRowOutofBounds2() {
--
-- // we've already created a new Row in @Before
-- for (int i=0;i<rowNum;i++){
-- table.createRow(URI("something_"+i));
-- }
-- }
--}
++/*
++ * 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 org.apache.jena.propertytable.AbstractPropertyTableTest;
++import org.junit.After;
++import org.junit.Assert;
++import org.junit.Before;
++import org.junit.Test;
++
++/**
++ * Tests for PropertyTableArrayImpl
++ *
++ */
++public class PropertyTableArrayImplTest extends AbstractPropertyTableTest{
++
++ private static int rowNum = 10;
++ private static int columnNum = 10 ;
++
++ @Before
++ public void setUp() {
++ table = new PropertyTableArrayImpl(rowNum, columnNum);
++ table2 = new PropertyTableArrayImpl(rowNum, columnNum);
++ row = table.createRow(rowSubject);
++
++ }
++
++ @After
++ public void tearDown() {
++ table = null;
++ table2 = null;
++ row = null;
++ }
++
++ @Test
++ public void testColumnOutofBounds1() {
++ for (int i=0;i<columnNum;i++){
++ table.createColumn(URI("something_"+i));
++ }
++ Assert.assertEquals(columnNum, table.getColumns().size());
++ }
++
++ @Test(expected = IllegalArgumentException.class)
++ public void testColumnOutofBounds2() {
++ for (int i=0;i<columnNum+1;i++){
++ table.createColumn(URI("something_"+i));
++ }
++ }
++
++ @Test
++ public void testRowOutofBounds1() {
++
++ // we've already created a new Row in @Before
++ for (int i=0;i<rowNum-1;i++){
++ table.createRow(URI("something_"+i));
++ }
++ Assert.assertEquals(rowNum, table.getAllRows().size());
++ }
++
++ @Test(expected = IllegalArgumentException.class)
++ public void testRowOutofBounds2() {
++
++ // we've already created a new Row in @Before
++ for (int i=0;i<rowNum;i++){
++ table.createRow(URI("something_"+i));
++ }
++ }
++}
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableBuilderForArrayImplTest.java
----------------------------------------------------------------------
diff --cc jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableBuilderForArrayImplTest.java
index 7b7e0c8,7b7e0c8..8021678
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableBuilderForArrayImplTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableBuilderForArrayImplTest.java
@@@ -1,39 -1,39 +1,39 @@@
--/*
-- * 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 org.junit.After;
--import org.junit.Before;
--
--public class PropertyTableBuilderForArrayImplTest extends AbstractPropertyTableBuilderTest{
--
-- private static int rowNum = 10;
-- private static int columnNum = 10 ;
--
-- @Before
-- public void setUp() {
-- table = new PropertyTableArrayImpl(rowNum, columnNum);
-- }
--
-- @After
-- public void tearDown() {
-- table = null;
-- }
--
--}
++/*
++ * 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 org.junit.After;
++import org.junit.Before;
++
++public class PropertyTableBuilderForArrayImplTest extends AbstractPropertyTableBuilderTest{
++
++ private static int rowNum = 10;
++ private static int columnNum = 10 ;
++
++ @Before
++ public void setUp() {
++ table = new PropertyTableArrayImpl(rowNum, columnNum);
++ }
++
++ @After
++ public void tearDown() {
++ table = null;
++ }
++
++}
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableBuilderForHashMapImplTest.java
----------------------------------------------------------------------
diff --cc jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableBuilderForHashMapImplTest.java
index f2768f5,f2768f5..8cd6cdc
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableBuilderForHashMapImplTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableBuilderForHashMapImplTest.java
@@@ -1,34 -1,34 +1,34 @@@
--/*
-- * 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 org.junit.After;
--import org.junit.Before;
--
--public class PropertyTableBuilderForHashMapImplTest extends AbstractPropertyTableBuilderTest{
-- @Before
-- public void setUp() {
-- table = new PropertyTableHashMapImpl();
-- }
--
-- @After
-- public void tearDown() {
-- table = null;
-- }
--}
++/*
++ * 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 org.junit.After;
++import org.junit.Before;
++
++public class PropertyTableBuilderForHashMapImplTest extends AbstractPropertyTableBuilderTest{
++ @Before
++ public void setUp() {
++ table = new PropertyTableHashMapImpl();
++ }
++
++ @After
++ public void tearDown() {
++ table = null;
++ }
++}
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImplTest.java
----------------------------------------------------------------------
diff --cc jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImplTest.java
index 33d95ae,33d95ae..68f87cf
--- a/jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImplTest.java
+++ b/jena-csv/src/test/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImplTest.java
@@@ -1,46 -1,46 +1,46 @@@
--/*
-- * 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 org.apache.jena.propertytable.AbstractPropertyTableTest;
--import org.junit.After;
--import org.junit.Before;
--
--/**
-- * Tests for PropertyTableHashMapImpl
-- *
-- */
--public class PropertyTableHashMapImplTest extends AbstractPropertyTableTest{
--
-- @Before
-- public void setUp() {
-- table = new PropertyTableHashMapImpl();
-- table2 = new PropertyTableHashMapImpl();
-- row = table.createRow(rowSubject);
--
-- }
--
-- @After
-- public void tearDown() {
-- table = null;
-- table2 = null;
-- row = null;
-- }
--
--}
++/*
++ * 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 org.apache.jena.propertytable.AbstractPropertyTableTest;
++import org.junit.After;
++import org.junit.Before;
++
++/**
++ * Tests for PropertyTableHashMapImpl
++ *
++ */
++public class PropertyTableHashMapImplTest extends AbstractPropertyTableTest{
++
++ @Before
++ public void setUp() {
++ table = new PropertyTableHashMapImpl();
++ table2 = new PropertyTableHashMapImpl();
++ row = table.createRow(rowSubject);
++
++ }
++
++ @After
++ public void tearDown() {
++ table = null;
++ table2 = null;
++ row = null;
++ }
++
++}
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/test/resources/test.csv
----------------------------------------------------------------------
diff --cc jena-csv/src/test/resources/test.csv
index b9ac0e1,b9ac0e1..306e493
--- a/jena-csv/src/test/resources/test.csv
+++ b/jena-csv/src/test/resources/test.csv
@@@ -1,3 -1,3 +1,3 @@@
--Town,Population,Predicate With Space,`~!@#$%^&*()-_=+[{]}|\;:'"<.>/?,1234
--Southton,123000.0,PredicateWithSpace1,NonURICharacters1,DigitalLocalName1
--Northville,654000,PredicateWithSpace2,NonURICharacters2,DigitalLocalName2
++Town,Population,Predicate With Space,`~!@#$%^&*()-_=+[{]}|\;:'"<.>/?,1234
++Southton,123000.0,PredicateWithSpace1,NonURICharacters1,DigitalLocalName1
++Northville,654000,PredicateWithSpace2,NonURICharacters2,DigitalLocalName2
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/AbstractNodeTupleWritable.java
----------------------------------------------------------------------
diff --cc jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/AbstractNodeTupleWritable.java
index 4449cc7,4449cc7..c9750f2
--- a/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/AbstractNodeTupleWritable.java
+++ b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/AbstractNodeTupleWritable.java
@@@ -1,194 -1,194 +1,194 @@@
--/*
-- * 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.hadoop.rdf.types;
--
--import java.io.DataInput;
--import java.io.DataOutput;
--import java.io.IOException;
--
--import org.apache.hadoop.io.WritableComparable;
--import org.apache.hadoop.io.WritableUtils;
--import org.apache.jena.graph.Node ;
--import org.apache.jena.sparql.util.NodeUtils ;
--
--/**
-- * A abstract general purpose writable where the actual class represented is
-- * composed of a number of {@link Node} instances
-- * <p>
-- * The binary encoding of this base implementation is just a variable integer
-- * indicating the number of nodes present followed by the binary encodings of
-- * the {@link NodeWritable} instances. Derived implementations may wish to
-- * override the {@link #readFields(DataInput)} and {@link #write(DataOutput)}
-- * methods in order to use more specialised encodings.
-- * </p>
-- *
-- * @param <T>
-- * Tuple type
-- */
--public abstract class AbstractNodeTupleWritable<T> implements WritableComparable<AbstractNodeTupleWritable<T>> {
--
-- private T tuple;
--
-- /**
-- * Creates a new empty instance
-- */
-- protected AbstractNodeTupleWritable() {
-- this(null);
-- }
--
-- /**
-- * Creates a new instance with the given value
-- *
-- * @param tuple
-- * Tuple value
-- */
-- protected AbstractNodeTupleWritable(T tuple) {
-- this.tuple = tuple;
-- }
--
-- /**
-- * Gets the tuple
-- *
-- * @return Tuple
-- */
-- public T get() {
-- return this.tuple;
-- }
--
-- /**
-- * Sets the tuple
-- *
-- * @param tuple
-- * Tuple
-- */
-- public void set(T tuple) {
-- this.tuple = tuple;
-- }
--
-- @Override
-- public void readFields(DataInput input) throws IOException {
-- // Determine how many nodes
-- int size = WritableUtils.readVInt(input);
-- Node[] ns = new Node[size];
--
-- NodeWritable nw = new NodeWritable();
-- for (int i = 0; i < ns.length; i++) {
-- nw.readFields(input);
-- ns[i] = nw.get();
-- }
--
-- // Load the tuple
-- this.tuple = this.createTuple(ns);
-- }
--
-- /**
-- * Creates the actual tuple type from an array of nodes
-- *
-- * @param ns
-- * Nodes
-- * @return Tuple
-- */
-- protected abstract T createTuple(Node[] ns);
--
-- @Override
-- public void write(DataOutput output) throws IOException {
-- // Determine how many nodes
-- Node[] ns = this.createNodes(this.tuple);
-- WritableUtils.writeVInt(output, ns.length);
--
-- // Write out nodes
-- NodeWritable nw = new NodeWritable();
-- for (int i = 0; i < ns.length; i++) {
-- nw.set(ns[i]);
-- nw.write(output);
-- }
-- }
--
-- /**
-- * Sets the tuple value
-- * <p>
-- * Intended only for internal use i.e. when a derived implementation
-- * overrides {@link #readFields(DataInput)} and needs to set the tuple value
-- * directly i.e. when a derived implementation is using a custom encoding
-- * scheme
-- * </p>
-- *
-- * @param tuple
-- * Tuple
-- */
-- protected final void setInternal(T tuple) {
-- this.tuple = tuple;
-- }
--
-- /**
-- * Converts the actual tuple type into an array of nodes
-- *
-- * @param tuple
-- * Tuples
-- * @return Nodes
-- */
-- protected abstract Node[] createNodes(T tuple);
--
-- /**
-- * Compares instances node by node
-- * <p>
-- * Derived implementations may wish to override this and substitute native
-- * tuple based comparisons
-- * </p>
-- *
-- * @param other
-- * Instance to compare with
-- */
-- @Override
-- public int compareTo(AbstractNodeTupleWritable<T> other) {
-- Node[] ns = this.createNodes(this.tuple);
-- Node[] otherNs = this.createNodes(other.tuple);
--
-- if (ns.length < otherNs.length) {
-- return -1;
-- } else if (ns.length > otherNs.length) {
-- return 1;
-- }
-- // Compare node by node
-- for (int i = 0; i < ns.length; i++) {
-- int c = NodeUtils.compareRDFTerms(ns[i], otherNs[i]);
-- if (c != 0)
-- return c;
-- }
-- return 0;
-- }
--
-- @Override
-- public String toString() {
-- return this.get().toString();
-- }
--
-- @Override
-- public int hashCode() {
-- return this.get().hashCode();
-- }
--
-- @SuppressWarnings("unchecked")
-- @Override
-- public boolean equals(Object other) {
-- if (!(other instanceof AbstractNodeTupleWritable))
-- return false;
-- return this.compareTo((AbstractNodeTupleWritable<T>) other) == 0;
-- }
--}
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++package org.apache.jena.hadoop.rdf.types;
++
++import java.io.DataInput;
++import java.io.DataOutput;
++import java.io.IOException;
++
++import org.apache.hadoop.io.WritableComparable;
++import org.apache.hadoop.io.WritableUtils;
++import org.apache.jena.graph.Node ;
++import org.apache.jena.sparql.util.NodeUtils ;
++
++/**
++ * A abstract general purpose writable where the actual class represented is
++ * composed of a number of {@link Node} instances
++ * <p>
++ * The binary encoding of this base implementation is just a variable integer
++ * indicating the number of nodes present followed by the binary encodings of
++ * the {@link NodeWritable} instances. Derived implementations may wish to
++ * override the {@link #readFields(DataInput)} and {@link #write(DataOutput)}
++ * methods in order to use more specialised encodings.
++ * </p>
++ *
++ * @param <T>
++ * Tuple type
++ */
++public abstract class AbstractNodeTupleWritable<T> implements WritableComparable<AbstractNodeTupleWritable<T>> {
++
++ private T tuple;
++
++ /**
++ * Creates a new empty instance
++ */
++ protected AbstractNodeTupleWritable() {
++ this(null);
++ }
++
++ /**
++ * Creates a new instance with the given value
++ *
++ * @param tuple
++ * Tuple value
++ */
++ protected AbstractNodeTupleWritable(T tuple) {
++ this.tuple = tuple;
++ }
++
++ /**
++ * Gets the tuple
++ *
++ * @return Tuple
++ */
++ public T get() {
++ return this.tuple;
++ }
++
++ /**
++ * Sets the tuple
++ *
++ * @param tuple
++ * Tuple
++ */
++ public void set(T tuple) {
++ this.tuple = tuple;
++ }
++
++ @Override
++ public void readFields(DataInput input) throws IOException {
++ // Determine how many nodes
++ int size = WritableUtils.readVInt(input);
++ Node[] ns = new Node[size];
++
++ NodeWritable nw = new NodeWritable();
++ for (int i = 0; i < ns.length; i++) {
++ nw.readFields(input);
++ ns[i] = nw.get();
++ }
++
++ // Load the tuple
++ this.tuple = this.createTuple(ns);
++ }
++
++ /**
++ * Creates the actual tuple type from an array of nodes
++ *
++ * @param ns
++ * Nodes
++ * @return Tuple
++ */
++ protected abstract T createTuple(Node[] ns);
++
++ @Override
++ public void write(DataOutput output) throws IOException {
++ // Determine how many nodes
++ Node[] ns = this.createNodes(this.tuple);
++ WritableUtils.writeVInt(output, ns.length);
++
++ // Write out nodes
++ NodeWritable nw = new NodeWritable();
++ for (int i = 0; i < ns.length; i++) {
++ nw.set(ns[i]);
++ nw.write(output);
++ }
++ }
++
++ /**
++ * Sets the tuple value
++ * <p>
++ * Intended only for internal use i.e. when a derived implementation
++ * overrides {@link #readFields(DataInput)} and needs to set the tuple value
++ * directly i.e. when a derived implementation is using a custom encoding
++ * scheme
++ * </p>
++ *
++ * @param tuple
++ * Tuple
++ */
++ protected final void setInternal(T tuple) {
++ this.tuple = tuple;
++ }
++
++ /**
++ * Converts the actual tuple type into an array of nodes
++ *
++ * @param tuple
++ * Tuples
++ * @return Nodes
++ */
++ protected abstract Node[] createNodes(T tuple);
++
++ /**
++ * Compares instances node by node
++ * <p>
++ * Derived implementations may wish to override this and substitute native
++ * tuple based comparisons
++ * </p>
++ *
++ * @param other
++ * Instance to compare with
++ */
++ @Override
++ public int compareTo(AbstractNodeTupleWritable<T> other) {
++ Node[] ns = this.createNodes(this.tuple);
++ Node[] otherNs = this.createNodes(other.tuple);
++
++ if (ns.length < otherNs.length) {
++ return -1;
++ } else if (ns.length > otherNs.length) {
++ return 1;
++ }
++ // Compare node by node
++ for (int i = 0; i < ns.length; i++) {
++ int c = NodeUtils.compareRDFTerms(ns[i], otherNs[i]);
++ if (c != 0)
++ return c;
++ }
++ return 0;
++ }
++
++ @Override
++ public String toString() {
++ return this.get().toString();
++ }
++
++ @Override
++ public int hashCode() {
++ return this.get().hashCode();
++ }
++
++ @SuppressWarnings("unchecked")
++ @Override
++ public boolean equals(Object other) {
++ if (!(other instanceof AbstractNodeTupleWritable))
++ return false;
++ return this.compareTo((AbstractNodeTupleWritable<T>) other) == 0;
++ }
++}
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicSetWritable.java
----------------------------------------------------------------------
diff --cc jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicSetWritable.java
index 4a29ec4,4a29ec4..39599fa
--- a/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicSetWritable.java
+++ b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicSetWritable.java
@@@ -1,21 -1,21 +1,21 @@@
--/*
-- * 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.
-- */
--
++/*
++ * 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.hadoop.rdf.types;
import java.io.DataInput;
@@@ -24,12 -24,12 +24,12 @@@ import java.io.IOException
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
--
++
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableUtils;
--import org.apache.jena.graph.Node ;
--import org.apache.jena.graph.NodeFactory ;
++import org.apache.jena.graph.Node ;
++import org.apache.jena.graph.NodeFactory ;
/**
* Represents a characteristic set which is comprised of a count of nodes for
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicWritable.java
----------------------------------------------------------------------
diff --cc jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicWritable.java
index cfb9606,cfb9606..9fc8a08
--- a/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicWritable.java
+++ b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/CharacteristicWritable.java
@@@ -1,30 -1,30 +1,30 @@@
--/*
-- * 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.
-- */
--
++/*
++ * 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.hadoop.rdf.types;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
--
++
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.WritableComparable;
--import org.apache.jena.graph.Node ;
++import org.apache.jena.graph.Node ;
/**
* Represents a characteristic for a single node and contains the node and a
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeTupleWritable.java
----------------------------------------------------------------------
diff --cc jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeTupleWritable.java
index 9bf7309,9bf7309..d65860b
--- a/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeTupleWritable.java
+++ b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeTupleWritable.java
@@@ -1,29 -1,29 +1,29 @@@
--/*
-- * 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.
-- */
--
++/*
++ * 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.hadoop.rdf.types;
--import java.io.DataInput;
--import java.io.IOException;
--
--import org.apache.jena.atlas.lib.tuple.Tuple ;
--import org.apache.jena.atlas.lib.tuple.TupleFactory ;
--import org.apache.jena.graph.Node ;
++import java.io.DataInput;
++import java.io.IOException;
++
++import org.apache.jena.atlas.lib.tuple.Tuple ;
++import org.apache.jena.atlas.lib.tuple.TupleFactory ;
++import org.apache.jena.graph.Node ;
/**
* A writable RDF tuple
@@@ -75,9 -75,9 +75,9 @@@ public class NodeTupleWritable extends
}
@Override
-- protected Node[] createNodes(Tuple<Node> tuple) {
++ protected Node[] createNodes(Tuple<Node> tuple) {
Node n[] = new Node[tuple.len()] ;
-- tuple.copyInto(n);
++ tuple.copyInto(n);
return n ;
}
}
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeWritable.java
----------------------------------------------------------------------
diff --cc jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeWritable.java
index 2316ae9,2316ae9..7b21b26
--- a/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeWritable.java
+++ b/jena-elephas/jena-elephas-common/src/main/java/org/apache/jena/hadoop/rdf/types/NodeWritable.java
@@@ -1,188 -1,188 +1,188 @@@
--/*
-- * 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.hadoop.rdf.types;
--
--import java.io.DataInput;
--import java.io.DataOutput;
--import java.io.IOException;
--
--import org.apache.hadoop.io.WritableComparable;
--import org.apache.hadoop.io.WritableComparator;
--import org.apache.jena.graph.Node ;
--import org.apache.jena.hadoop.rdf.types.comparators.SimpleBinaryComparator;
--import org.apache.jena.hadoop.rdf.types.converters.ThriftConverter;
--import org.apache.jena.riot.thrift.TRDF;
--import org.apache.jena.riot.thrift.ThriftConvert;
--import org.apache.jena.riot.thrift.wire.RDF_Term;
--import org.apache.jena.sparql.util.NodeUtils ;
--import org.apache.thrift.TException;
--
--/**
-- * A writable for {@link Node} instances
-- * <p>
-- * This uses <a
-- * href="http://afs.github.io/rdf-thrift/rdf-binary-thrift.html">RDF Thrift</a>
-- * for the binary encoding of terms. The in-memory storage for this type is both
-- * a {@link Node} and a {@link RDF_Term} with lazy conversion between the two
-- * forms as necessary.
-- * </p>
-- */
--public class NodeWritable implements WritableComparable<NodeWritable> {
--
-- static {
-- WritableComparator.define(NodeWritable.class, new SimpleBinaryComparator());
-- }
--
-- private Node node;
-- private RDF_Term term = new RDF_Term();
--
-- /**
-- * Creates an empty writable
-- */
-- public NodeWritable() {
-- this(null);
-- }
--
-- /**
-- * Creates a new instance from the given input
-- *
-- * @param input
-- * Input
-- * @return New instance
-- * @throws IOException
-- */
-- public static NodeWritable read(DataInput input) throws IOException {
-- NodeWritable nw = new NodeWritable();
-- nw.readFields(input);
-- return nw;
-- }
--
-- /**
-- * Creates a new writable with the given value
-- *
-- * @param n
-- * Node
-- */
-- public NodeWritable(Node n) {
-- this.set(n);
-- }
--
-- /**
-- * Gets the node
-- *
-- * @return Node
-- */
-- public Node get() {
-- // We may not have yet loaded the node
-- if (this.node == null) {
-- // If term is set to undefined then node is supposed to be null
-- if (this.term.isSet() && !this.term.isSetUndefined()) {
-- this.node = ThriftConvert.convert(this.term);
-- }
-- }
-- return this.node;
-- }
--
-- /**
-- * Sets the node
-- *
-- * @param n
-- * Node
-- */
-- public void set(Node n) {
-- this.node = n;
-- // Clear the term for now
-- // We only convert the Node to a term as and when we want to write it
-- // out in order to not waste effort if the value is never written out
-- this.term.clear();
-- }
--
-- @Override
-- public void readFields(DataInput input) throws IOException {
-- // Clear previous value
-- this.node = null;
-- this.term.clear();
--
-- // Read in the new value
-- int termLength = input.readInt();
-- byte[] buffer = new byte[termLength];
-- input.readFully(buffer);
-- try {
-- ThriftConverter.fromBytes(buffer, this.term);
-- } catch (TException e) {
-- throw new IOException(e);
-- }
--
-- // Note that we don't convert it back into a Node at this time
-- }
--
-- @Override
-- public void write(DataOutput output) throws IOException {
-- // May not yet have prepared the Thrift term
-- if (!this.term.isSet()) {
-- if (this.node == null) {
-- this.term.setUndefined(TRDF.UNDEF);
-- } else {
-- ThriftConvert.toThrift(this.node, null, this.term, false);
-- }
-- }
--
-- // Write out the Thrift term
-- byte[] buffer;
-- try {
-- buffer = ThriftConverter.toBytes(this.term);
-- } catch (TException e) {
-- throw new IOException(e);
-- }
-- output.writeInt(buffer.length);
-- output.write(buffer);
-- }
--
-- @Override
-- public int compareTo(NodeWritable other) {
-- // Use get() rather than accessing the field directly because the node
-- // field is lazily instantiated from the Thrift term
-- return NodeUtils.compareRDFTerms(this.get(), other.get());
-- }
--
-- @Override
-- public String toString() {
-- // Use get() rather than accessing the field directly because the node
-- // field is lazily instantiated from the Thrift term
-- Node n = this.get();
-- if (n == null)
-- return "";
-- return n.toString();
-- }
--
-- @Override
-- public int hashCode() {
-- // Use get() rather than accessing the field directly because the node
-- // field is lazily instantiated from the Thrift term
-- Node n = this.get();
-- return n != null ? this.get().hashCode() : 0;
-- }
--
-- @Override
-- public boolean equals(Object other) {
-- if (!(other instanceof NodeWritable))
-- return false;
-- return this.compareTo((NodeWritable) other) == 0;
-- }
--}
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++package org.apache.jena.hadoop.rdf.types;
++
++import java.io.DataInput;
++import java.io.DataOutput;
++import java.io.IOException;
++
++import org.apache.hadoop.io.WritableComparable;
++import org.apache.hadoop.io.WritableComparator;
++import org.apache.jena.graph.Node ;
++import org.apache.jena.hadoop.rdf.types.comparators.SimpleBinaryComparator;
++import org.apache.jena.hadoop.rdf.types.converters.ThriftConverter;
++import org.apache.jena.riot.thrift.TRDF;
++import org.apache.jena.riot.thrift.ThriftConvert;
++import org.apache.jena.riot.thrift.wire.RDF_Term;
++import org.apache.jena.sparql.util.NodeUtils ;
++import org.apache.thrift.TException;
++
++/**
++ * A writable for {@link Node} instances
++ * <p>
++ * This uses <a
++ * href="http://afs.github.io/rdf-thrift/rdf-binary-thrift.html">RDF Thrift</a>
++ * for the binary encoding of terms. The in-memory storage for this type is both
++ * a {@link Node} and a {@link RDF_Term} with lazy conversion between the two
++ * forms as necessary.
++ * </p>
++ */
++public class NodeWritable implements WritableComparable<NodeWritable> {
++
++ static {
++ WritableComparator.define(NodeWritable.class, new SimpleBinaryComparator());
++ }
++
++ private Node node;
++ private RDF_Term term = new RDF_Term();
++
++ /**
++ * Creates an empty writable
++ */
++ public NodeWritable() {
++ this(null);
++ }
++
++ /**
++ * Creates a new instance from the given input
++ *
++ * @param input
++ * Input
++ * @return New instance
++ * @throws IOException
++ */
++ public static NodeWritable read(DataInput input) throws IOException {
++ NodeWritable nw = new NodeWritable();
++ nw.readFields(input);
++ return nw;
++ }
++
++ /**
++ * Creates a new writable with the given value
++ *
++ * @param n
++ * Node
++ */
++ public NodeWritable(Node n) {
++ this.set(n);
++ }
++
++ /**
++ * Gets the node
++ *
++ * @return Node
++ */
++ public Node get() {
++ // We may not have yet loaded the node
++ if (this.node == null) {
++ // If term is set to undefined then node is supposed to be null
++ if (this.term.isSet() && !this.term.isSetUndefined()) {
++ this.node = ThriftConvert.convert(this.term);
++ }
++ }
++ return this.node;
++ }
++
++ /**
++ * Sets the node
++ *
++ * @param n
++ * Node
++ */
++ public void set(Node n) {
++ this.node = n;
++ // Clear the term for now
++ // We only convert the Node to a term as and when we want to write it
++ // out in order to not waste effort if the value is never written out
++ this.term.clear();
++ }
++
++ @Override
++ public void readFields(DataInput input) throws IOException {
++ // Clear previous value
++ this.node = null;
++ this.term.clear();
++
++ // Read in the new value
++ int termLength = input.readInt();
++ byte[] buffer = new byte[termLength];
++ input.readFully(buffer);
++ try {
++ ThriftConverter.fromBytes(buffer, this.term);
++ } catch (TException e) {
++ throw new IOException(e);
++ }
++
++ // Note that we don't convert it back into a Node at this time
++ }
++
++ @Override
++ public void write(DataOutput output) throws IOException {
++ // May not yet have prepared the Thrift term
++ if (!this.term.isSet()) {
++ if (this.node == null) {
++ this.term.setUndefined(TRDF.UNDEF);
++ } else {
++ ThriftConvert.toThrift(this.node, null, this.term, false);
++ }
++ }
++
++ // Write out the Thrift term
++ byte[] buffer;
++ try {
++ buffer = ThriftConverter.toBytes(this.term);
++ } catch (TException e) {
++ throw new IOException(e);
++ }
++ output.writeInt(buffer.length);
++ output.write(buffer);
++ }
++
++ @Override
++ public int compareTo(NodeWritable other) {
++ // Use get() rather than accessing the field directly because the node
++ // field is lazily instantiated from the Thrift term
++ return NodeUtils.compareRDFTerms(this.get(), other.get());
++ }
++
++ @Override
++ public String toString() {
++ // Use get() rather than accessing the field directly because the node
++ // field is lazily instantiated from the Thrift term
++ Node n = this.get();
++ if (n == null)
++ return "";
++ return n.toString();
++ }
++
++ @Override
++ public int hashCode() {
++ // Use get() rather than accessing the field directly because the node
++ // field is lazily instantiated from the Thrift term
++ Node n = this.get();
++ return n != null ? this.get().hashCode() : 0;
++ }
++
++ @Override
++ public boolean equals(Object other) {
++ if (!(other instanceof NodeWritable))
++ return false;
++ return this.compareTo((NodeWritable) other) == 0;
++ }
++}