http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-core/testing/wg/localtests/ManifestRestriction001.rdf
----------------------------------------------------------------------
diff --cc jena-core/testing/wg/localtests/ManifestRestriction001.rdf
index 1cee138,1cee138..b125d17
--- a/jena-core/testing/wg/localtests/ManifestRestriction001.rdf
+++ b/jena-core/testing/wg/localtests/ManifestRestriction001.rdf
@@@ -1,30 -1,30 +1,30 @@@
--<!--
--  Local test files use in Jena2 development
---->
--<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
--      xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#'
--      xmlns:rtest='http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#'
--      xmlns:otest='http://www.w3.org/2002/03owlt/testOntology#'
--      xmlns:dc='http://purl.org/dc/elements/1.0/'
--      xmlns='http://www.w3.org/2002/03owlt/localtests/ManifestRestriction001#'
--      xmlns:owl='http://www.w3.org/2002/07/owl#'
--      
xml:base='http://www.w3.org/2002/03owlt/localtests/ManifestRestriction001'
-->
--<otest:PositiveEntailmentTest rdf:ID='intersection1'>
--   <rtest:status>Jena internal</rtest:status>
--   <dc:creator>Dave Reynolds</dc:creator>
--   <rtest:description rdf:parseType='Literal'>
--       Test core intersectionOf processing - 'if' direction.
--   </rtest:description>
--   <rtest:premiseDocument>
--         <rtest:RDF-XML-Document rdf:about='premisesRestriction001' >
--              <otest:level 
rdf:resource='http://www.w3.org/2002/03owlt/testOntology#Lite' />
--         </rtest:RDF-XML-Document>
--   </rtest:premiseDocument>
--   <rtest:conclusionDocument>
--         <rtest:RDF-XML-Document rdf:about='conclusionsRestriction001' >
--              <otest:level 
rdf:resource='http://www.w3.org/2002/03owlt/testOntology#Lite' />
--         </rtest:RDF-XML-Document>
--   </rtest:conclusionDocument>
--</otest:PositiveEntailmentTest >
--</rdf:RDF>
++<!--
++  Local test files use in Jena2 development
++-->
++<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
++      xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#'
++      xmlns:rtest='http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#'
++      xmlns:otest='http://www.w3.org/2002/03owlt/testOntology#'
++      xmlns:dc='http://purl.org/dc/elements/1.0/'
++      xmlns='http://www.w3.org/2002/03owlt/localtests/ManifestRestriction001#'
++      xmlns:owl='http://www.w3.org/2002/07/owl#'
++      
xml:base='http://www.w3.org/2002/03owlt/localtests/ManifestRestriction001'
++>
++<otest:PositiveEntailmentTest rdf:ID='intersection1'>
++   <rtest:status>Jena internal</rtest:status>
++   <dc:creator>Dave Reynolds</dc:creator>
++   <rtest:description rdf:parseType='Literal'>
++       Test core intersectionOf processing - 'if' direction.
++   </rtest:description>
++   <rtest:premiseDocument>
++         <rtest:RDF-XML-Document rdf:about='premisesRestriction001' >
++              <otest:level 
rdf:resource='http://www.w3.org/2002/03owlt/testOntology#Lite' />
++         </rtest:RDF-XML-Document>
++   </rtest:premiseDocument>
++   <rtest:conclusionDocument>
++         <rtest:RDF-XML-Document rdf:about='conclusionsRestriction001' >
++              <otest:level 
rdf:resource='http://www.w3.org/2002/03owlt/testOntology#Lite' />
++         </rtest:RDF-XML-Document>
++   </rtest:conclusionDocument>
++</otest:PositiveEntailmentTest >
++</rdf:RDF>

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-core/testing/wg/localtests/ManifestSubclass001.rdf
----------------------------------------------------------------------
diff --cc jena-core/testing/wg/localtests/ManifestSubclass001.rdf
index b91aa4a,b91aa4a..603a183
--- a/jena-core/testing/wg/localtests/ManifestSubclass001.rdf
+++ b/jena-core/testing/wg/localtests/ManifestSubclass001.rdf
@@@ -1,30 -1,30 +1,30 @@@
--<!--
--  Local test files use in Jena2 development
---->
--<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
--      xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#'
--      xmlns:rtest='http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#'
--      xmlns:otest='http://www.w3.org/2002/03owlt/testOntology#'
--      xmlns:dc='http://purl.org/dc/elements/1.0/'
--      xmlns='http://www.w3.org/2002/03owlt/localtests/ManifestSubclass001#'
--      xmlns:owl='http://www.w3.org/2002/07/owl#'
--      xml:base='http://www.w3.org/2002/03owlt/localtests/ManifestSubclass001'
-->
--<otest:PositiveEntailmentTest rdf:ID='intersection1'>
--   <rtest:status>Jena internal</rtest:status>
--   <dc:creator>Dave Reynolds</dc:creator>
--   <rtest:description rdf:parseType='Literal'>
--              Basic subclass closure checking.
--   </rtest:description>
--   <rtest:premiseDocument>
--         <rtest:RDF-XML-Document rdf:about='premisesSubclass001' >
--              <otest:level 
rdf:resource='http://www.w3.org/2002/03owlt/testOntology#Lite' />
--         </rtest:RDF-XML-Document>
--   </rtest:premiseDocument>
--   <rtest:conclusionDocument>
--         <rtest:RDF-XML-Document rdf:about='conclusionsSubclass001' >
--              <otest:level 
rdf:resource='http://www.w3.org/2002/03owlt/testOntology#Lite' />
--         </rtest:RDF-XML-Document>
--   </rtest:conclusionDocument>
--</otest:PositiveEntailmentTest >
--</rdf:RDF>
++<!--
++  Local test files use in Jena2 development
++-->
++<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
++      xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#'
++      xmlns:rtest='http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#'
++      xmlns:otest='http://www.w3.org/2002/03owlt/testOntology#'
++      xmlns:dc='http://purl.org/dc/elements/1.0/'
++      xmlns='http://www.w3.org/2002/03owlt/localtests/ManifestSubclass001#'
++      xmlns:owl='http://www.w3.org/2002/07/owl#'
++      xml:base='http://www.w3.org/2002/03owlt/localtests/ManifestSubclass001'
++>
++<otest:PositiveEntailmentTest rdf:ID='intersection1'>
++   <rtest:status>Jena internal</rtest:status>
++   <dc:creator>Dave Reynolds</dc:creator>
++   <rtest:description rdf:parseType='Literal'>
++              Basic subclass closure checking.
++   </rtest:description>
++   <rtest:premiseDocument>
++         <rtest:RDF-XML-Document rdf:about='premisesSubclass001' >
++              <otest:level 
rdf:resource='http://www.w3.org/2002/03owlt/testOntology#Lite' />
++         </rtest:RDF-XML-Document>
++   </rtest:premiseDocument>
++   <rtest:conclusionDocument>
++         <rtest:RDF-XML-Document rdf:about='conclusionsSubclass001' >
++              <otest:level 
rdf:resource='http://www.w3.org/2002/03owlt/testOntology#Lite' />
++         </rtest:RDF-XML-Document>
++   </rtest:conclusionDocument>
++</otest:PositiveEntailmentTest >
++</rdf:RDF>

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-core/testing/wg/localtests/conclusions008.rdf
----------------------------------------------------------------------
diff --cc jena-core/testing/wg/localtests/conclusions008.rdf
index 394347b,394347b..4aec7e5
--- a/jena-core/testing/wg/localtests/conclusions008.rdf
+++ b/jena-core/testing/wg/localtests/conclusions008.rdf
@@@ -1,24 -1,24 +1,24 @@@
--<?xml version="1.0"?>
--<!--
--  Local test files use in Jena2 development
--
--  Infer domain/range from inverseof
---->
--
--<!DOCTYPE rdf:RDF [
--    <!ENTITY eg   'urn:x-hp:eg'>
--    <!ENTITY rdf  'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
--    <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
--    <!ENTITY xsd  'http://www.w3.org/2001/XMLSchema#'>
--    <!ENTITY owl  "http://www.w3.org/2002/07/owl#"; >
--]>
--
--<rdf:RDF xmlns:rdf="&rdf;" xmlns:rdfs="&rdfs;" xmlns:xsd="&xsd;" 
xmlns:owl="&owl;"
--         xml:base="&eg;" xmlns="&eg;#">
--
--      <owl:ObjectProperty rdf:about="#q">
--        <rdfs:domain rdf:resource="&eg;#B" />
--        <rdfs:range rdf:resource="&eg;#A" />
--      </owl:ObjectProperty>
--      
--</rdf:RDF>
++<?xml version="1.0"?>
++<!--
++  Local test files use in Jena2 development
++
++  Infer domain/range from inverseof
++-->
++
++<!DOCTYPE rdf:RDF [
++    <!ENTITY eg   'urn:x-hp:eg'>
++    <!ENTITY rdf  'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
++    <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
++    <!ENTITY xsd  'http://www.w3.org/2001/XMLSchema#'>
++    <!ENTITY owl  "http://www.w3.org/2002/07/owl#"; >
++]>
++
++<rdf:RDF xmlns:rdf="&rdf;" xmlns:rdfs="&rdfs;" xmlns:xsd="&xsd;" 
xmlns:owl="&owl;"
++         xml:base="&eg;" xmlns="&eg;#">
++
++      <owl:ObjectProperty rdf:about="#q">
++        <rdfs:domain rdf:resource="&eg;#B" />
++        <rdfs:range rdf:resource="&eg;#A" />
++      </owl:ObjectProperty>
++      
++</rdf:RDF>

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-core/testing/wg/localtests/conclusionsRestriction001.rdf
----------------------------------------------------------------------
diff --cc jena-core/testing/wg/localtests/conclusionsRestriction001.rdf
index 90a6ff9,90a6ff9..20de9e2
--- a/jena-core/testing/wg/localtests/conclusionsRestriction001.rdf
+++ b/jena-core/testing/wg/localtests/conclusionsRestriction001.rdf
@@@ -1,17 -1,17 +1,17 @@@
--<!--
--  Local test files use in Jena2 development
--
--  Test core intersectionOf processing - 'if' direction.
---->
--<rdf:RDF
--    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
--    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
--    xmlns:owl="http://www.w3.org/2002/07/owl#";
--    
xml:base="http://www.w3.org/2002/03owlt/equivalentClass/premisesRestriction001"; 
>
--    
--    <owl:Class rdf:ID="c1">
-- <!--     <owl:equivalentClass rdf:resource="#c2" /> -->
--      <rdfs:subClassOf rdf:resource="#c2" />
--      </owl:Class>
--         
--</rdf:RDF>
++<!--
++  Local test files use in Jena2 development
++
++  Test core intersectionOf processing - 'if' direction.
++-->
++<rdf:RDF
++    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
++    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
++    xmlns:owl="http://www.w3.org/2002/07/owl#";
++    
xml:base="http://www.w3.org/2002/03owlt/equivalentClass/premisesRestriction001"; 
>
++    
++    <owl:Class rdf:ID="c1">
++ <!--     <owl:equivalentClass rdf:resource="#c2" /> -->
++      <rdfs:subClassOf rdf:resource="#c2" />
++      </owl:Class>
++         
++</rdf:RDF>

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-core/testing/wg/localtests/conclusionsSubclass001.rdf
----------------------------------------------------------------------
diff --cc jena-core/testing/wg/localtests/conclusionsSubclass001.rdf
index 269c1d3,269c1d3..fa2fe3a
--- a/jena-core/testing/wg/localtests/conclusionsSubclass001.rdf
+++ b/jena-core/testing/wg/localtests/conclusionsSubclass001.rdf
@@@ -1,20 -1,20 +1,20 @@@
--<!--
--  Local test files use in Jena2 development
--
--  Test core intersectionOf processing - 'if' direction.
---->
--<rdf:RDF
--    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
--    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
--    xmlns:owl="http://www.w3.org/2002/07/owl#";
--    
xml:base="http://www.w3.org/2002/03owlt/equivalentClass/premisesSubclass001"; >
--    
--    <rdf:Description rdf:about="#a">
--      <rdfs:subClassOf rdf:resource="#c"/>
--    </rdf:Description>
--    
--    <rdf:Description rdf:about="http://www.w3.org/2002/07/owl#Thing";>
--      <owl:equivalentClass rdf:resource="#d"/>
--    </rdf:Description>
--
--</rdf:RDF>
++<!--
++  Local test files use in Jena2 development
++
++  Test core intersectionOf processing - 'if' direction.
++-->
++<rdf:RDF
++    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
++    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
++    xmlns:owl="http://www.w3.org/2002/07/owl#";
++    
xml:base="http://www.w3.org/2002/03owlt/equivalentClass/premisesSubclass001"; >
++    
++    <rdf:Description rdf:about="#a">
++      <rdfs:subClassOf rdf:resource="#c"/>
++    </rdf:Description>
++    
++    <rdf:Description rdf:about="http://www.w3.org/2002/07/owl#Thing";>
++      <owl:equivalentClass rdf:resource="#d"/>
++    </rdf:Description>
++
++</rdf:RDF>

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-core/testing/wg/localtests/premises008.rdf
----------------------------------------------------------------------
diff --cc jena-core/testing/wg/localtests/premises008.rdf
index 9df8af7,9df8af7..f85c1f5
--- a/jena-core/testing/wg/localtests/premises008.rdf
+++ b/jena-core/testing/wg/localtests/premises008.rdf
@@@ -1,31 -1,31 +1,31 @@@
--<?xml version="1.0"?>
--<!--
--  Local test files use in Jena2 development
--
--  Infer domain/range from inverseof
---->
--
--<!DOCTYPE rdf:RDF [
--    <!ENTITY eg   'urn:x-hp:eg'>
--    <!ENTITY rdf  'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
--    <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
--    <!ENTITY xsd  'http://www.w3.org/2001/XMLSchema#'>
--    <!ENTITY owl  "http://www.w3.org/2002/07/owl#"; >
--]>
--
--<rdf:RDF xmlns:rdf="&rdf;" xmlns:rdfs="&rdfs;" xmlns:xsd="&xsd;" 
xmlns:owl="&owl;"
--         xml:base="&eg;" xmlns="&eg;#">
--
--    <owl:Class rdf:about="#A" />
--    <owl:Class rdf:about="#B" />
--
--      <owl:ObjectProperty rdf:about="#p">
--        <rdfs:domain rdf:resource="&eg;#A" />
--        <rdfs:range rdf:resource="&eg;#B" />
--      </owl:ObjectProperty>
--      
--      <owl:ObjectProperty rdf:about="#q">
--        <owl:inverseOf rdf:resource="&eg;#p"/>
--      </owl:ObjectProperty>
--
--</rdf:RDF>
++<?xml version="1.0"?>
++<!--
++  Local test files use in Jena2 development
++
++  Infer domain/range from inverseof
++-->
++
++<!DOCTYPE rdf:RDF [
++    <!ENTITY eg   'urn:x-hp:eg'>
++    <!ENTITY rdf  'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
++    <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
++    <!ENTITY xsd  'http://www.w3.org/2001/XMLSchema#'>
++    <!ENTITY owl  "http://www.w3.org/2002/07/owl#"; >
++]>
++
++<rdf:RDF xmlns:rdf="&rdf;" xmlns:rdfs="&rdfs;" xmlns:xsd="&xsd;" 
xmlns:owl="&owl;"
++         xml:base="&eg;" xmlns="&eg;#">
++
++    <owl:Class rdf:about="#A" />
++    <owl:Class rdf:about="#B" />
++
++      <owl:ObjectProperty rdf:about="#p">
++        <rdfs:domain rdf:resource="&eg;#A" />
++        <rdfs:range rdf:resource="&eg;#B" />
++      </owl:ObjectProperty>
++      
++      <owl:ObjectProperty rdf:about="#q">
++        <owl:inverseOf rdf:resource="&eg;#p"/>
++      </owl:ObjectProperty>
++
++</rdf:RDF>

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-core/testing/wg/localtests/premisesRestriction001.rdf
----------------------------------------------------------------------
diff --cc jena-core/testing/wg/localtests/premisesRestriction001.rdf
index 1ecf367,1ecf367..2e724bc
--- a/jena-core/testing/wg/localtests/premisesRestriction001.rdf
+++ b/jena-core/testing/wg/localtests/premisesRestriction001.rdf
@@@ -1,33 -1,33 +1,33 @@@
--<!--
--  Local test files use in Jena2 development
--
--  Test core intersectionOf processing - 'if' direction.
---->
--<rdf:RDF
--    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
--    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
--    xmlns:owl="http://www.w3.org/2002/07/owl#";
--    
xml:base="http://www.w3.org/2002/03owlt/equivalentClass/premisesRestriction001"; 
>
--    
--    <owl:Class rdf:about="#d" />
--    <owl:ObjectProperty rdf:about="#p" />
--    
--    <owl:Class rdf:ID="c1">
--      <owl:equivalentClass>
--        <owl:Restriction>
--           <owl:onProperty rdf:resource="#p"/>
--           <owl:someValuesFrom rdf:resource="#d" />
--        </owl:Restriction>
--      </owl:equivalentClass>
--     </owl:Class>
--    
--    <owl:Class rdf:ID="c2">
--      <owl:equivalentClass>
--        <owl:Restriction>
--           <owl:onProperty rdf:resource="#p"/>
--           <owl:someValuesFrom rdf:resource="#d" />
--        </owl:Restriction>
--      </owl:equivalentClass>
--     </owl:Class>
--     
--</rdf:RDF>
++<!--
++  Local test files use in Jena2 development
++
++  Test core intersectionOf processing - 'if' direction.
++-->
++<rdf:RDF
++    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
++    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
++    xmlns:owl="http://www.w3.org/2002/07/owl#";
++    
xml:base="http://www.w3.org/2002/03owlt/equivalentClass/premisesRestriction001"; 
>
++    
++    <owl:Class rdf:about="#d" />
++    <owl:ObjectProperty rdf:about="#p" />
++    
++    <owl:Class rdf:ID="c1">
++      <owl:equivalentClass>
++        <owl:Restriction>
++           <owl:onProperty rdf:resource="#p"/>
++           <owl:someValuesFrom rdf:resource="#d" />
++        </owl:Restriction>
++      </owl:equivalentClass>
++     </owl:Class>
++    
++    <owl:Class rdf:ID="c2">
++      <owl:equivalentClass>
++        <owl:Restriction>
++           <owl:onProperty rdf:resource="#p"/>
++           <owl:someValuesFrom rdf:resource="#d" />
++        </owl:Restriction>
++      </owl:equivalentClass>
++     </owl:Class>
++     
++</rdf:RDF>

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-core/testing/wg/localtests/premisesSubclass001.rdf
----------------------------------------------------------------------
diff --cc jena-core/testing/wg/localtests/premisesSubclass001.rdf
index d61c3b9,d61c3b9..e80bf40
--- a/jena-core/testing/wg/localtests/premisesSubclass001.rdf
+++ b/jena-core/testing/wg/localtests/premisesSubclass001.rdf
@@@ -1,31 -1,31 +1,31 @@@
--<!--
--  Local test files use in Jena2 development
--
--  Test core intersectionOf processing - 'if' direction.
---->
--<rdf:RDF
--    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
--    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
--    xmlns:owl="http://www.w3.org/2002/07/owl#";
--    
xml:base="http://www.w3.org/2002/03owlt/equivalentClass/premisesSubclass001"; >
--    
--    <owl:Class rdf:about="#a">
--      <rdfs:subClassOf rdf:resource="#b"/>
--    </owl:Class>
--    
--    <owl:Class rdf:about="#b">
--      <rdfs:subClassOf rdf:resource="#c"/>
--    </owl:Class>
--    
--    <owl:Class rdf:about="#c">
--      <rdfs:subClassOf rdf:resource="#d"/>
--    </owl:Class>
--    
--    <owl:Class rdf:about="#d">
--    </owl:Class>
--    
--    <rdf:Description rdf:about="http://www.w3.org/2002/07/owl#Thing";>
--      <rdfs:subClassOf rdf:resource="#d"/>
--    </rdf:Description>
--
--</rdf:RDF>
++<!--
++  Local test files use in Jena2 development
++
++  Test core intersectionOf processing - 'if' direction.
++-->
++<rdf:RDF
++    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
++    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
++    xmlns:owl="http://www.w3.org/2002/07/owl#";
++    
xml:base="http://www.w3.org/2002/03owlt/equivalentClass/premisesSubclass001"; >
++    
++    <owl:Class rdf:about="#a">
++      <rdfs:subClassOf rdf:resource="#b"/>
++    </owl:Class>
++    
++    <owl:Class rdf:about="#b">
++      <rdfs:subClassOf rdf:resource="#c"/>
++    </owl:Class>
++    
++    <owl:Class rdf:about="#c">
++      <rdfs:subClassOf rdf:resource="#d"/>
++    </owl:Class>
++    
++    <owl:Class rdf:about="#d">
++    </owl:Class>
++    
++    <rdf:Description rdf:about="http://www.w3.org/2002/07/owl#Thing";>
++      <rdfs:subClassOf rdf:resource="#d"/>
++    </rdf:Description>
++
++</rdf:RDF>

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/Column.java
----------------------------------------------------------------------
diff --cc jena-csv/src/main/java/org/apache/jena/propertytable/Column.java
index 5650d07,5650d07..50d7ebf
--- a/jena-csv/src/main/java/org/apache/jena/propertytable/Column.java
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/Column.java
@@@ -1,45 -1,45 +1,45 @@@
--/*
-- * 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 ;
--
--/**
-- * Each Column of the PropertyTable has an unique columnKey Node of the 
predicate (or p for short).
-- * 
-- */
--public interface Column {
--
--      /**
--       * @return the PropertyTable it belongs to
--       */
--      PropertyTable getTable();
--
--      /**
--       * @return the columnKey Node of the predicate
--       */
--      Node getColumnKey();
--      
--      /**
--       * @return all the values within a Column
--       */
--      List<Node> getValues();
--
--}
++/*
++ * 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 ;
++
++/**
++ * Each Column of the PropertyTable has an unique columnKey Node of the 
predicate (or p for short).
++ * 
++ */
++public interface Column {
++
++      /**
++       * @return the PropertyTable it belongs to
++       */
++      PropertyTable getTable();
++
++      /**
++       * @return the columnKey Node of the predicate
++       */
++      Node getColumnKey();
++      
++      /**
++       * @return all the values within a Column
++       */
++      List<Node> getValues();
++
++}

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/PropertyTable.java
----------------------------------------------------------------------
diff --cc 
jena-csv/src/main/java/org/apache/jena/propertytable/PropertyTable.java
index 93b68c1,93b68c1..78c6967
--- a/jena-csv/src/main/java/org/apache/jena/propertytable/PropertyTable.java
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/PropertyTable.java
@@@ -1,126 -1,126 +1,126 @@@
--/*
-- * 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 java.util.List;
--
--import org.apache.jena.graph.Node ;
--import org.apache.jena.graph.Triple ;
--import org.apache.jena.util.iterator.ExtendedIterator ;
--
--/**
-- * PropertyTable is designed to be a table of RDF terms, or Nodes in Jena. 
-- * Each Column of the PropertyTable has an unique columnKey Node of the 
predicate (or p for short).
-- * Each Row of the PropertyTable has an unique rowKey Node of the subject (or 
s for short).
-- * You can use getColumn() to get the Column by its columnKey Node of the 
predicate, while getRow() for Row.
-- * 
-- */
--public interface PropertyTable {
--      
--      /**
--       * Query for ?s <p> <o>
--       * @param column the Column with the columnKey Node of the predicate
--       * @param value the object (or value) Node
--       * @return the ExtendedIterator of the matching Triples
--       */
--      ExtendedIterator<Triple> getTripleIterator(Column column, Node value);
--
--      /**
--       * Query for ?s <p> ?o
--       * @param column the Column with the columnKey Node of the predicate
--       * @return the ExtendedIterator of the matching Triples
--       */
--      ExtendedIterator<Triple> getTripleIterator(Column column);
--      
--      /**
--       * Query for ?s ?p <o>
--       * @param value the object (or value) Node
--       * @return the ExtendedIterator of the matching Triples
--       */
--      ExtendedIterator<Triple> getTripleIterator(Node value);
--      
--      /**
--       * Query for <s> ?p ?o
--       * @param row the Row with the rowKey Node of the subject
--       * @return the ExtendedIterator of the matching Triples
--       */
--      ExtendedIterator<Triple> getTripleIterator(Row row);
--      
--      /**
--       * Query for ?s ?p ?o
--       * @return all of the Triples of the PropertyTable
--       */
--      ExtendedIterator<Triple> getTripleIterator();
--
--      /**
--       * @return all of the Columns of the PropertyTable
--       */
--      Collection<Column> getColumns();
--
--      /**
--       * Get Column by its columnKey Node of the predicate
--       * @param p columnKey Node of the predicate
--       * @return the Column
--       */
--      Column getColumn(Node p);
--
--      /**
--       * Create a Column by its columnKey Node of the predicate
--       * @param p
--       */
--      Column createColumn(Node p);
--
--      /**
--       * Get Row by its rowKey Node of the subject
--       * @param s rowKey Node of the subject
--       * @return the Row
--       */
--      Row getRow(Node s);
--      
--      
--      /**
--       * Create Row by its rowKey Node of the subject
--       * @param s rowKey Node of the subject
--       * @return the Row created
--       */
--      Row createRow(Node s);
--      
--      
--      /**
--       * Get all of the rows
--       */
--      List<Row> getAllRows() ;
--      
--      
--      /**
--       * Get all the values within a Column
--       * @param column
--       * @return the values
--       */
--      List<Node> getColumnValues(Column column);
--      
--      /**
--       * Get the Rows matching the value of a Column
--       * @param column the Column with the columnKey Node of the predicate
--       * @param value the object (or value) Node
--       * @return the matching Rows
--       */
--      Collection<Row> getMatchingRows(Column column, Node value);
--      
--}
++/*
++ * 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 java.util.List;
++
++import org.apache.jena.graph.Node ;
++import org.apache.jena.graph.Triple ;
++import org.apache.jena.util.iterator.ExtendedIterator ;
++
++/**
++ * PropertyTable is designed to be a table of RDF terms, or Nodes in Jena. 
++ * Each Column of the PropertyTable has an unique columnKey Node of the 
predicate (or p for short).
++ * Each Row of the PropertyTable has an unique rowKey Node of the subject (or 
s for short).
++ * You can use getColumn() to get the Column by its columnKey Node of the 
predicate, while getRow() for Row.
++ * 
++ */
++public interface PropertyTable {
++      
++      /**
++       * Query for ?s <p> <o>
++       * @param column the Column with the columnKey Node of the predicate
++       * @param value the object (or value) Node
++       * @return the ExtendedIterator of the matching Triples
++       */
++      ExtendedIterator<Triple> getTripleIterator(Column column, Node value);
++
++      /**
++       * Query for ?s <p> ?o
++       * @param column the Column with the columnKey Node of the predicate
++       * @return the ExtendedIterator of the matching Triples
++       */
++      ExtendedIterator<Triple> getTripleIterator(Column column);
++      
++      /**
++       * Query for ?s ?p <o>
++       * @param value the object (or value) Node
++       * @return the ExtendedIterator of the matching Triples
++       */
++      ExtendedIterator<Triple> getTripleIterator(Node value);
++      
++      /**
++       * Query for <s> ?p ?o
++       * @param row the Row with the rowKey Node of the subject
++       * @return the ExtendedIterator of the matching Triples
++       */
++      ExtendedIterator<Triple> getTripleIterator(Row row);
++      
++      /**
++       * Query for ?s ?p ?o
++       * @return all of the Triples of the PropertyTable
++       */
++      ExtendedIterator<Triple> getTripleIterator();
++
++      /**
++       * @return all of the Columns of the PropertyTable
++       */
++      Collection<Column> getColumns();
++
++      /**
++       * Get Column by its columnKey Node of the predicate
++       * @param p columnKey Node of the predicate
++       * @return the Column
++       */
++      Column getColumn(Node p);
++
++      /**
++       * Create a Column by its columnKey Node of the predicate
++       * @param p
++       */
++      Column createColumn(Node p);
++
++      /**
++       * Get Row by its rowKey Node of the subject
++       * @param s rowKey Node of the subject
++       * @return the Row
++       */
++      Row getRow(Node s);
++      
++      
++      /**
++       * Create Row by its rowKey Node of the subject
++       * @param s rowKey Node of the subject
++       * @return the Row created
++       */
++      Row createRow(Node s);
++      
++      
++      /**
++       * Get all of the rows
++       */
++      List<Row> getAllRows() ;
++      
++      
++      /**
++       * Get all the values within a Column
++       * @param column
++       * @return the values
++       */
++      List<Node> getColumnValues(Column column);
++      
++      /**
++       * Get the Rows matching the value of a Column
++       * @param column the Column with the columnKey Node of the predicate
++       * @param value the object (or value) Node
++       * @return the matching Rows
++       */
++      Collection<Row> getMatchingRows(Column column, Node value);
++      
++}

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/Row.java
----------------------------------------------------------------------
diff --cc jena-csv/src/main/java/org/apache/jena/propertytable/Row.java
index 3824d8f,3824d8f..cb2ae9b
--- a/jena-csv/src/main/java/org/apache/jena/propertytable/Row.java
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/Row.java
@@@ -1,75 -1,75 +1,75 @@@
--/*
-- * 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.Triple ;
--import org.apache.jena.util.iterator.ExtendedIterator ;
--
--/**
-- * Each Row of the PropertyTable has an unique rowKey Node of the subject (or 
s for short).
-- *
-- */
--public interface Row {
--
--      /**
--       * @return the PropertyTable it belongs to
--       */
--      PropertyTable getTable();
--      
--      /**
--       * Set the value of the Column in this Row
--       * @param column
--       * @param value
--       */
--      void setValue(Column column, Node value);
--      
--      /**
--       * Get the value of the Column in this Row
--       * @param column
--       * @return value
--       */
--      Node getValue(Column column);
--      
--      
--      /**
--       * Get the value of the Column in this Row
--       * @param ColumnKey
--       * @return value
--       */
--      Node getValue(Node ColumnKey);
--      
--      /**
--       * @return the rowKey Node of the subject
--       */
--      Node getRowKey();
--      
--      /**
--       * @return the Triple Iterator over the values in this Row
--       */
--      ExtendedIterator<Triple> getTripleIterator();
--      
--      /**
--       * @return all of the Columns of the PropertyTable
--       */
--      Collection<Column> 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;
++
++import java.util.Collection;
++
++import org.apache.jena.graph.Node ;
++import org.apache.jena.graph.Triple ;
++import org.apache.jena.util.iterator.ExtendedIterator ;
++
++/**
++ * Each Row of the PropertyTable has an unique rowKey Node of the subject (or 
s for short).
++ *
++ */
++public interface Row {
++
++      /**
++       * @return the PropertyTable it belongs to
++       */
++      PropertyTable getTable();
++      
++      /**
++       * Set the value of the Column in this Row
++       * @param column
++       * @param value
++       */
++      void setValue(Column column, Node value);
++      
++      /**
++       * Get the value of the Column in this Row
++       * @param column
++       * @return value
++       */
++      Node getValue(Column column);
++      
++      
++      /**
++       * Get the value of the Column in this Row
++       * @param ColumnKey
++       * @return value
++       */
++      Node getValue(Node ColumnKey);
++      
++      /**
++       * @return the rowKey Node of the subject
++       */
++      Node getRowKey();
++      
++      /**
++       * @return the Triple Iterator over the values in this Row
++       */
++      ExtendedIterator<Triple> getTripleIterator();
++      
++      /**
++       * @return all of the Columns of the PropertyTable
++       */
++      Collection<Column> getColumns();
++
++}

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/graph/GraphCSV.java
----------------------------------------------------------------------
diff --cc 
jena-csv/src/main/java/org/apache/jena/propertytable/graph/GraphCSV.java
index d002ec6,d002ec6..4f2e3fd
--- a/jena-csv/src/main/java/org/apache/jena/propertytable/graph/GraphCSV.java
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/graph/GraphCSV.java
@@@ -1,62 -1,62 +1,62 @@@
--/*
-- * 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.propertytable.PropertyTable;
--import org.apache.jena.propertytable.impl.PropertyTableBuilder;
--
--
--/**
-- * GraphCSV is a sub class of GraphPropertyTable aiming at CSV data.
-- * Its constructor takes a CSV file path as the parameter, parse the file 
using a CSV Parser,
-- * and makes a PropertyTable through PropertyTableBuilder.
-- *
-- */
--public class GraphCSV extends GraphPropertyTable {
--      
--      public static GraphCSV createHashMapImpl( String csvFilePath ){
--              return new GraphCSVHashMapImpl(csvFilePath);
--      }
--      
--      public static GraphCSV createArrayImpl( String csvFilePath ){
--              return new GraphCSVArrayImpl(csvFilePath);
--      }
--      
--      protected GraphCSV (PropertyTable table) {
--              super(table);
--      }
--      
--      // use the Java array implementation of PropertyTable for default
--      public GraphCSV ( String csvFilePath ){
--              
super(PropertyTableBuilder.buildPropetyTableArrayImplFromCsv(csvFilePath));
--      }
--}
--
--
--class GraphCSVHashMapImpl extends GraphCSV{
--      protected GraphCSVHashMapImpl(String csvFilePath){
--              
super(PropertyTableBuilder.buildPropetyTableHashMapImplFromCsv(csvFilePath));
--      }
--}
--
--class GraphCSVArrayImpl extends GraphCSV{
--      protected GraphCSVArrayImpl(String csvFilePath){
--              
super(PropertyTableBuilder.buildPropetyTableArrayImplFromCsv(csvFilePath));
--      }
--}
++/*
++ * 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.propertytable.PropertyTable;
++import org.apache.jena.propertytable.impl.PropertyTableBuilder;
++
++
++/**
++ * GraphCSV is a sub class of GraphPropertyTable aiming at CSV data.
++ * Its constructor takes a CSV file path as the parameter, parse the file 
using a CSV Parser,
++ * and makes a PropertyTable through PropertyTableBuilder.
++ *
++ */
++public class GraphCSV extends GraphPropertyTable {
++      
++      public static GraphCSV createHashMapImpl( String csvFilePath ){
++              return new GraphCSVHashMapImpl(csvFilePath);
++      }
++      
++      public static GraphCSV createArrayImpl( String csvFilePath ){
++              return new GraphCSVArrayImpl(csvFilePath);
++      }
++      
++      protected GraphCSV (PropertyTable table) {
++              super(table);
++      }
++      
++      // use the Java array implementation of PropertyTable for default
++      public GraphCSV ( String csvFilePath ){
++              
super(PropertyTableBuilder.buildPropetyTableArrayImplFromCsv(csvFilePath));
++      }
++}
++
++
++class GraphCSVHashMapImpl extends GraphCSV{
++      protected GraphCSVHashMapImpl(String csvFilePath){
++              
super(PropertyTableBuilder.buildPropetyTableHashMapImplFromCsv(csvFilePath));
++      }
++}
++
++class GraphCSVArrayImpl extends GraphCSV{
++      protected GraphCSVArrayImpl(String csvFilePath){
++              
super(PropertyTableBuilder.buildPropetyTableArrayImplFromCsv(csvFilePath));
++      }
++}

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/graph/GraphPropertyTable.java
----------------------------------------------------------------------
diff --cc 
jena-csv/src/main/java/org/apache/jena/propertytable/graph/GraphPropertyTable.java
index 7e5e5b5,7e5e5b5..b538173
--- 
a/jena-csv/src/main/java/org/apache/jena/propertytable/graph/GraphPropertyTable.java
+++ 
b/jena-csv/src/main/java/org/apache/jena/propertytable/graph/GraphPropertyTable.java
@@@ -1,200 -1,200 +1,200 @@@
--/*
-- * 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 java.util.ArrayList ;
--import java.util.Locale ;
--import java.util.function.Predicate;
--
--import org.apache.jena.graph.Node ;
--import org.apache.jena.graph.NodeFactory ;
--import org.apache.jena.graph.Triple ;
--import org.apache.jena.graph.impl.GraphBase ;
--import org.apache.jena.propertytable.Column ;
--import org.apache.jena.propertytable.PropertyTable ;
--import org.apache.jena.propertytable.Row ;
--import org.apache.jena.sparql.core.BasicPattern ;
--import org.apache.jena.util.iterator.ExtendedIterator ;
--import org.apache.jena.util.iterator.NullIterator ;
--import org.apache.jena.util.iterator.WrappedIterator ;
--
--/**
-- * GraphPropertyTable implements the Graph interface (read-only) over a 
PropertyTable.
-- * This is subclass from GraphBase and implements find().
-- * The graphBaseFind()(for matching a Triple) and propertyTableBaseFind()(for 
matching a whole Row) methods can choose the access route based on the find 
arguments.
-- * GraphPropertyTable holds/wraps an reference of the PropertyTable instance, 
so that such a Graph can be treated in a more table-like fashion.
-- *
-- */
--public class GraphPropertyTable extends GraphBase {
--
--      private PropertyTable pt;
--
--      public GraphPropertyTable(PropertyTable pt) {
--              this.pt = pt;
--      }
--
--      public PropertyTable getPropertyTable() {
--              return pt;
--      }
--
--      @Override
--      protected ExtendedIterator<Triple> graphBaseFind(Triple triple) {
--              //System.out.println(m);
--
--              if (this.pt == null) {
--                      return NullIterator.instance();
--              }
--
--              ExtendedIterator<Triple> iter = null;
--
--              Node s = triple.getMatchSubject();
--              Node p = triple.getMatchPredicate();
--              Node o = triple.getMatchObject();
--
--              if (isConcrete(p) && isConcrete(o)) {
--                      //System.out.println("1");
--                      iter = pt.getTripleIterator(pt.getColumn(p), o);
--              } else if (isConcrete(p)) {
--                      //System.out.println("2");
--                      Column column = this.pt.getColumn(p);
--                      if (column != null) {
--                              iter = pt.getTripleIterator(column);
--                      } else {
--                              return NullIterator.instance();
--                      }
--              } else if (isConcrete(o)) {
--                      //System.out.println("3");
--                      iter = pt.getTripleIterator(o);
--              } else{
--                      //System.out.println("4");
--                      iter = pt.getTripleIterator();
--              }
--
--              return iter.filterKeep(new TripleMatchFilterEquality(triple));
--
--      }
--      
--      protected ExtendedIterator<Row> propertyTableBaseFind(RowMatch m) {
--              
--              if (this.pt == null) {
--                      return NullIterator.instance();
--              }
--              
--              ExtendedIterator<Row> iter = null;
--
--              Node s = m.getMatchSubject();
--
--              if ( isConcrete(s) ){
--                      Row row= pt.getRow(s);
--                      if (row == null){
--                              return NullIterator.instance();
--                      } else {
--                              ArrayList<Row> rows = new ArrayList<Row>();
--                              rows.add(row);
--                              return WrappedIterator.create(rows.iterator());
--                      }
--              } else {
--                      iter = 
WrappedIterator.create(pt.getAllRows().iterator());
--              }
--              
--              return iter.filterKeep(new RowMatchFilterEquality( m ));
--              
--      }
--      
--      static class RowMatchFilterEquality implements Predicate<Row> {
--              final protected RowMatch rMatch;
--
--              public RowMatchFilterEquality(RowMatch rMatch) {
--                      this.rMatch = rMatch;
--              }
--
--              @Override
--              public boolean test(Row r) {
--                      return rowContained(rMatch, r);
--              }
--
--      }
--      
--      static boolean rowContained(RowMatch rMatch, Row row) {
--                      
--              boolean contained = equalNode(rMatch.getSubject(), 
row.getRowKey());
--              if(contained){
--                      BasicPattern pattern =rMatch.getBasicPattern();
--                      for(Triple triple: pattern ){
--                              contained = equalNode(triple.getObject(), 
row.getValue( triple.getPredicate()) );
--                              if (! contained){
--                                      break;
--                              }
--                      }
--              } 
--              return contained;
--      }
--      
--
--      static class TripleMatchFilterEquality implements Predicate<Triple> {
--              final protected Triple tMatch;
--
--              /** Creates new TripleMatchFilter */
--              public TripleMatchFilterEquality(Triple tMatch) {
--                      this.tMatch = tMatch;
--              }
--
--              @Override
--              public boolean test(Triple t) {
--                      return tripleContained(tMatch, t);
--              }
--
--      }
--
--      static boolean tripleContained(Triple patternTriple, Triple dataTriple) 
{
--              return equalNode(patternTriple.getSubject(), 
dataTriple.getSubject())
--                              && equalNode(patternTriple.getPredicate(),
--                                              dataTriple.getPredicate())
--                              && equalNode(patternTriple.getObject(), 
dataTriple.getObject());
--      }
--
--      private static boolean equalNode(Node m, Node n) {
--              // m should not be null unless .getMatchXXXX used to get the 
node.
--              // Language tag canonicalization
--              n = fixupNode(n);
--              m = fixupNode(m);
--              return (m == null) || (m == Node.ANY) || m.equals(n);
--      }
--
--      private static Node fixupNode(Node node) {
--              if (node == null || node == Node.ANY)
--                      return node;
--
--              // RDF says ... language tags should be canonicalized to lower 
case.
--              if (node.isLiteral()) {
--                      String lang = node.getLiteralLanguage();
--                      if (lang != null && !lang.equals(""))
--                              node = 
NodeFactory.createLiteral(node.getLiteralLexicalForm(),
--                                              lang.toLowerCase(Locale.ROOT),
--                                              node.getLiteralDatatype());
--              }
--              return node;
--      }
--
--      private boolean isConcrete(Node node) {
--              boolean wild = (node == null || node == Node.ANY);
--              return !wild;
--      }
--
--}
++/*
++ * 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 java.util.ArrayList ;
++import java.util.Locale ;
++import java.util.function.Predicate;
++
++import org.apache.jena.graph.Node ;
++import org.apache.jena.graph.NodeFactory ;
++import org.apache.jena.graph.Triple ;
++import org.apache.jena.graph.impl.GraphBase ;
++import org.apache.jena.propertytable.Column ;
++import org.apache.jena.propertytable.PropertyTable ;
++import org.apache.jena.propertytable.Row ;
++import org.apache.jena.sparql.core.BasicPattern ;
++import org.apache.jena.util.iterator.ExtendedIterator ;
++import org.apache.jena.util.iterator.NullIterator ;
++import org.apache.jena.util.iterator.WrappedIterator ;
++
++/**
++ * GraphPropertyTable implements the Graph interface (read-only) over a 
PropertyTable.
++ * This is subclass from GraphBase and implements find().
++ * The graphBaseFind()(for matching a Triple) and propertyTableBaseFind()(for 
matching a whole Row) methods can choose the access route based on the find 
arguments.
++ * GraphPropertyTable holds/wraps an reference of the PropertyTable instance, 
so that such a Graph can be treated in a more table-like fashion.
++ *
++ */
++public class GraphPropertyTable extends GraphBase {
++
++      private PropertyTable pt;
++
++      public GraphPropertyTable(PropertyTable pt) {
++              this.pt = pt;
++      }
++
++      public PropertyTable getPropertyTable() {
++              return pt;
++      }
++
++      @Override
++      protected ExtendedIterator<Triple> graphBaseFind(Triple triple) {
++              //System.out.println(m);
++
++              if (this.pt == null) {
++                      return NullIterator.instance();
++              }
++
++              ExtendedIterator<Triple> iter = null;
++
++              Node s = triple.getMatchSubject();
++              Node p = triple.getMatchPredicate();
++              Node o = triple.getMatchObject();
++
++              if (isConcrete(p) && isConcrete(o)) {
++                      //System.out.println("1");
++                      iter = pt.getTripleIterator(pt.getColumn(p), o);
++              } else if (isConcrete(p)) {
++                      //System.out.println("2");
++                      Column column = this.pt.getColumn(p);
++                      if (column != null) {
++                              iter = pt.getTripleIterator(column);
++                      } else {
++                              return NullIterator.instance();
++                      }
++              } else if (isConcrete(o)) {
++                      //System.out.println("3");
++                      iter = pt.getTripleIterator(o);
++              } else{
++                      //System.out.println("4");
++                      iter = pt.getTripleIterator();
++              }
++
++              return iter.filterKeep(new TripleMatchFilterEquality(triple));
++
++      }
++      
++      protected ExtendedIterator<Row> propertyTableBaseFind(RowMatch m) {
++              
++              if (this.pt == null) {
++                      return NullIterator.instance();
++              }
++              
++              ExtendedIterator<Row> iter = null;
++
++              Node s = m.getMatchSubject();
++
++              if ( isConcrete(s) ){
++                      Row row= pt.getRow(s);
++                      if (row == null){
++                              return NullIterator.instance();
++                      } else {
++                              ArrayList<Row> rows = new ArrayList<Row>();
++                              rows.add(row);
++                              return WrappedIterator.create(rows.iterator());
++                      }
++              } else {
++                      iter = 
WrappedIterator.create(pt.getAllRows().iterator());
++              }
++              
++              return iter.filterKeep(new RowMatchFilterEquality( m ));
++              
++      }
++      
++      static class RowMatchFilterEquality implements Predicate<Row> {
++              final protected RowMatch rMatch;
++
++              public RowMatchFilterEquality(RowMatch rMatch) {
++                      this.rMatch = rMatch;
++              }
++
++              @Override
++              public boolean test(Row r) {
++                      return rowContained(rMatch, r);
++              }
++
++      }
++      
++      static boolean rowContained(RowMatch rMatch, Row row) {
++                      
++              boolean contained = equalNode(rMatch.getSubject(), 
row.getRowKey());
++              if(contained){
++                      BasicPattern pattern =rMatch.getBasicPattern();
++                      for(Triple triple: pattern ){
++                              contained = equalNode(triple.getObject(), 
row.getValue( triple.getPredicate()) );
++                              if (! contained){
++                                      break;
++                              }
++                      }
++              } 
++              return contained;
++      }
++      
++
++      static class TripleMatchFilterEquality implements Predicate<Triple> {
++              final protected Triple tMatch;
++
++              /** Creates new TripleMatchFilter */
++              public TripleMatchFilterEquality(Triple tMatch) {
++                      this.tMatch = tMatch;
++              }
++
++              @Override
++              public boolean test(Triple t) {
++                      return tripleContained(tMatch, t);
++              }
++
++      }
++
++      static boolean tripleContained(Triple patternTriple, Triple dataTriple) 
{
++              return equalNode(patternTriple.getSubject(), 
dataTriple.getSubject())
++                              && equalNode(patternTriple.getPredicate(),
++                                              dataTriple.getPredicate())
++                              && equalNode(patternTriple.getObject(), 
dataTriple.getObject());
++      }
++
++      private static boolean equalNode(Node m, Node n) {
++              // m should not be null unless .getMatchXXXX used to get the 
node.
++              // Language tag canonicalization
++              n = fixupNode(n);
++              m = fixupNode(m);
++              return (m == null) || (m == Node.ANY) || m.equals(n);
++      }
++
++      private static Node fixupNode(Node node) {
++              if (node == null || node == Node.ANY)
++                      return node;
++
++              // RDF says ... language tags should be canonicalized to lower 
case.
++              if (node.isLiteral()) {
++                      String lang = node.getLiteralLanguage();
++                      if (lang != null && !lang.equals(""))
++                              node = 
NodeFactory.createLiteral(node.getLiteralLexicalForm(),
++                                              lang.toLowerCase(Locale.ROOT),
++                                              node.getLiteralDatatype());
++              }
++              return node;
++      }
++
++      private boolean isConcrete(Node node) {
++              boolean wild = (node == null || node == Node.ANY);
++              return !wild;
++      }
++
++}

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/graph/QueryIterPropertyTable.java
----------------------------------------------------------------------
diff --cc 
jena-csv/src/main/java/org/apache/jena/propertytable/graph/QueryIterPropertyTable.java
index 8ebfa72,8ebfa72..4349623
--- 
a/jena-csv/src/main/java/org/apache/jena/propertytable/graph/QueryIterPropertyTable.java
+++ 
b/jena-csv/src/main/java/org/apache/jena/propertytable/graph/QueryIterPropertyTable.java
@@@ -1,114 -1,114 +1,114 @@@
--/*
-- * 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 java.util.ArrayList ;
--import java.util.Collection ;
--import java.util.HashMap ;
--import java.util.List ;
--
--import org.apache.jena.atlas.io.IndentedWriter ;
--import org.apache.jena.atlas.lib.Lib ;
--import org.apache.jena.graph.Graph ;
--import org.apache.jena.graph.Node ;
--import org.apache.jena.graph.Triple ;
--import org.apache.jena.sparql.core.BasicPattern ;
--import org.apache.jena.sparql.engine.ExecutionContext ;
--import org.apache.jena.sparql.engine.QueryIterator ;
--import org.apache.jena.sparql.engine.binding.Binding ;
--import org.apache.jena.sparql.engine.iterator.QueryIter1 ;
--import org.apache.jena.sparql.serializer.SerializationContext ;
--import org.apache.jena.sparql.util.FmtUtils ;
--
--/**
-- * Split the incoming BasicPattern by subjects, (i.e. it becomes multiple sub 
BasicPatterns grouped by the same subjects.
-- *
-- */
--public class QueryIterPropertyTable extends QueryIter1 {
--      
--      private BasicPattern pattern;
--      private Graph graph;
--      private QueryIterator output;
--
--      public static QueryIterator create(QueryIterator input,
--                      BasicPattern pattern, ExecutionContext execContext) {
--              return new QueryIterPropertyTable(input, pattern, execContext);
--      }
--
--      private QueryIterPropertyTable(QueryIterator input, BasicPattern 
pattern,
--                      ExecutionContext execContext) {
--              super(input, execContext);
--              this.pattern = pattern;
--              graph = execContext.getActiveGraph();
--              // Create a chain of triple iterators.
--              QueryIterator chain = getInput();
--              Collection<BasicPattern> patterns = sort(pattern);
--              for (BasicPattern p : patterns)
--                      chain = new QueryIterPropertyTableRow(chain, p, 
execContext);
--              output = chain;
--      }
--
--      private Collection<BasicPattern> sort(BasicPattern pattern) {
--              HashMap<Node, BasicPattern> map = new HashMap<Node, 
BasicPattern>();
--              for (Triple triple : pattern.getList()) {
--                      Node subject = triple.getSubject();
--                      if (!map.containsKey(subject)) {
--                              List<Triple> triples = new ArrayList<Triple>();
--                              BasicPattern p = BasicPattern.wrap(triples);
--                              map.put(subject, p);
--                              p.add(triple);
--                      } else {
--                              map.get(subject).add(triple);
--                      }
--              }
--              return map.values();
--      }
--
--      @Override
--      protected boolean hasNextBinding() {
--              return output.hasNext();
--      }
--
--      @Override
--      protected Binding moveToNextBinding() {
--              return output.nextBinding();
--      }
--
--      @Override
--      protected void closeSubIterator() {
--              if (output != null)
--                      output.close();
--              output = null;
--      }
--
--      @Override
--      protected void requestSubCancel() {
--              if (output != null)
--                      output.cancel();
--      }
--
--      @Override
--      protected void details(IndentedWriter out, SerializationContext sCxt) {
--              out.print(Lib.className(this));
--              out.println();
--              out.incIndent();
--              FmtUtils.formatPattern(out, pattern, sCxt);
--              out.decIndent();
--      }
--}
++/*
++ * 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 java.util.ArrayList ;
++import java.util.Collection ;
++import java.util.HashMap ;
++import java.util.List ;
++
++import org.apache.jena.atlas.io.IndentedWriter ;
++import org.apache.jena.atlas.lib.Lib ;
++import org.apache.jena.graph.Graph ;
++import org.apache.jena.graph.Node ;
++import org.apache.jena.graph.Triple ;
++import org.apache.jena.sparql.core.BasicPattern ;
++import org.apache.jena.sparql.engine.ExecutionContext ;
++import org.apache.jena.sparql.engine.QueryIterator ;
++import org.apache.jena.sparql.engine.binding.Binding ;
++import org.apache.jena.sparql.engine.iterator.QueryIter1 ;
++import org.apache.jena.sparql.serializer.SerializationContext ;
++import org.apache.jena.sparql.util.FmtUtils ;
++
++/**
++ * Split the incoming BasicPattern by subjects, (i.e. it becomes multiple sub 
BasicPatterns grouped by the same subjects.
++ *
++ */
++public class QueryIterPropertyTable extends QueryIter1 {
++      
++      private BasicPattern pattern;
++      private Graph graph;
++      private QueryIterator output;
++
++      public static QueryIterator create(QueryIterator input,
++                      BasicPattern pattern, ExecutionContext execContext) {
++              return new QueryIterPropertyTable(input, pattern, execContext);
++      }
++
++      private QueryIterPropertyTable(QueryIterator input, BasicPattern 
pattern,
++                      ExecutionContext execContext) {
++              super(input, execContext);
++              this.pattern = pattern;
++              graph = execContext.getActiveGraph();
++              // Create a chain of triple iterators.
++              QueryIterator chain = getInput();
++              Collection<BasicPattern> patterns = sort(pattern);
++              for (BasicPattern p : patterns)
++                      chain = new QueryIterPropertyTableRow(chain, p, 
execContext);
++              output = chain;
++      }
++
++      private Collection<BasicPattern> sort(BasicPattern pattern) {
++              HashMap<Node, BasicPattern> map = new HashMap<Node, 
BasicPattern>();
++              for (Triple triple : pattern.getList()) {
++                      Node subject = triple.getSubject();
++                      if (!map.containsKey(subject)) {
++                              List<Triple> triples = new ArrayList<Triple>();
++                              BasicPattern p = BasicPattern.wrap(triples);
++                              map.put(subject, p);
++                              p.add(triple);
++                      } else {
++                              map.get(subject).add(triple);
++                      }
++              }
++              return map.values();
++      }
++
++      @Override
++      protected boolean hasNextBinding() {
++              return output.hasNext();
++      }
++
++      @Override
++      protected Binding moveToNextBinding() {
++              return output.nextBinding();
++      }
++
++      @Override
++      protected void closeSubIterator() {
++              if (output != null)
++                      output.close();
++              output = null;
++      }
++
++      @Override
++      protected void requestSubCancel() {
++              if (output != null)
++                      output.cancel();
++      }
++
++      @Override
++      protected void details(IndentedWriter out, SerializationContext sCxt) {
++              out.print(Lib.className(this));
++              out.println();
++              out.incIndent();
++              FmtUtils.formatPattern(out, pattern, sCxt);
++              out.decIndent();
++      }
++}

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/graph/QueryIterPropertyTableRow.java
----------------------------------------------------------------------
diff --cc 
jena-csv/src/main/java/org/apache/jena/propertytable/graph/QueryIterPropertyTableRow.java
index 8aeec57,8aeec57..3b28f24
--- 
a/jena-csv/src/main/java/org/apache/jena/propertytable/graph/QueryIterPropertyTableRow.java
+++ 
b/jena-csv/src/main/java/org/apache/jena/propertytable/graph/QueryIterPropertyTableRow.java
@@@ -1,243 -1,243 +1,243 @@@
--/*
-- * 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 java.util.ArrayList;
--import java.util.List;
--
--import org.apache.jena.graph.Node ;
--import org.apache.jena.graph.Triple ;
--import org.apache.jena.propertytable.PropertyTable;
--import org.apache.jena.propertytable.Row;
--
--
--import org.apache.jena.sparql.ARQInternalErrorException ;
--import org.apache.jena.sparql.core.BasicPattern ;
--import org.apache.jena.sparql.core.Var ;
--import org.apache.jena.sparql.engine.ExecutionContext ;
--import org.apache.jena.sparql.engine.QueryIterator ;
--import org.apache.jena.sparql.engine.binding.Binding ;
--import org.apache.jena.sparql.engine.binding.BindingFactory ;
--import org.apache.jena.sparql.engine.binding.BindingMap ;
--import org.apache.jena.sparql.engine.iterator.QueryIter ;
--import org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply ;
--import org.apache.jena.util.iterator.ClosableIterator ;
--import org.apache.jena.util.iterator.ExtendedIterator ;
--import org.apache.jena.util.iterator.NiceIterator ;
--import org.apache.jena.util.iterator.WrappedIterator ;
--
--/**
-- * If the triple size within a BasicePattern is greater than 1 (i.e. at least 
2 triples), it's turned into a row querying.
-- *
-- */
--public class QueryIterPropertyTableRow  extends QueryIterRepeatApply{
--      
--      
--    private final BasicPattern pattern ;
--    
--    public QueryIterPropertyTableRow( QueryIterator input,
--                                   BasicPattern pattern , 
--                                   ExecutionContext cxt)
--    {
--        super(input, cxt) ;
--        this.pattern = pattern ;
--    }
--
--    @Override
--    protected QueryIterator nextStage(Binding binding)
--    {
--        return new RowMapper(binding, pattern, getExecContext()) ;
--    }
--    
--    static int countMapper = 0 ; 
--    static class RowMapper extends QueryIter
--    {   
--      private PropertyTable table;
--      
--      private BasicPattern pattern;
--        private Binding binding ;
--        private ClosableIterator<Row> graphIter ;
--        private Binding slot = null ;
--        private boolean finished = false ;
--        private volatile boolean cancelled = false ;
--
--        RowMapper(Binding binding, BasicPattern pattern, ExecutionContext cxt)
--        {
--            super(cxt) ;
--            GraphPropertyTable graph = 
(GraphPropertyTable)cxt.getActiveGraph() ;
--            
--            this.pattern = substitute(pattern, binding);
--            this.binding = binding ;
--            BasicPattern pattern2 = tripleNode(pattern);
--            
--            ExtendedIterator<Row> iter = graph.propertyTableBaseFind( new 
RowMatch( pattern2) );
--            
--            if ( false )
--            {
--                // Materialize the results now. Debugging only.
--                List<Row> x = iter.toList() ;
--                this.graphIter = WrappedIterator.create(x.iterator()) ;
--                iter.close();
--            }
--            else
--                // Stream.
--                this.graphIter = iter ;
--        }
--
--        private static Node tripleNode(Node node)
--        {
--            if ( node.isVariable() )
--                return Node.ANY ;
--            return node ;
--        }
--        
--        private static BasicPattern tripleNode(BasicPattern pattern)
--        {
--              List<Triple> triples = new ArrayList<Triple>();
--              for (Triple triple: pattern){
--                      triples.add( tripleNode(triple) );
--              }
--              return BasicPattern.wrap(triples);
--        }
--        
--        private static Triple tripleNode(Triple triple){
--            Node s = tripleNode(triple.getSubject()) ;
--            Node p = tripleNode(triple.getPredicate()) ;
--            Node o = tripleNode(triple.getObject()) ;
--            return Triple.create(s, p, o);
--        }
--
--        private static Node substitute(Node node, Binding binding)
--        {
--            if ( Var.isVar(node) )
--            {
--                Node x = binding.get(Var.alloc(node)) ;
--                if ( x != null )
--                    return x ;
--            }
--            return node ;
--        }
--        
--        private static Triple substitute(Triple triple, Binding binding){
--            Node s = substitute(triple.getSubject(), binding) ;
--            Node p = substitute(triple.getPredicate(), binding) ;
--            Node o = substitute(triple.getObject(), binding) ;
--            return Triple.create(s, p, o);
--        }
--        
--        private static BasicPattern substitute(BasicPattern pattern , Binding 
binding)
--        {
--              List<Triple> triples = new ArrayList<Triple>();
--              for (Triple triple: pattern){
--                      triples.add( substitute(triple,binding) );
--              }
--              return BasicPattern.wrap(triples);
--        }
--        
--        private Binding mapper(Row r)
--        {
--            BindingMap results = BindingFactory.create(binding) ;
--
--            if ( ! insert(pattern, r, results) )
--                return null ; 
--            return results ;
--        }
--        
--        private static boolean insert(BasicPattern input, Row output, 
BindingMap results)
--        {     
--              for (Triple triple: input){
--                      if (! insert(triple, output, results) ){
--                              return false;
--                      }
--              }
--              return true;
--        }
--        
--        private static boolean insert(Triple input, Row output, BindingMap 
results){
--              if ( ! insert(input.getSubject(), output.getRowKey(), results) )
--                return false ;
--//            if ( ! insert(input.getPredicate(), output.get, results) )
--//                return false ;
--            if ( ! insert(input.getObject(), output.getValue( 
input.getPredicate() ), results) )
--                return false ;
--            return true;
--        }
--
--        private static boolean insert(Node inputNode, Node outputNode, 
BindingMap results)
--        {
--            if ( ! Var.isVar(inputNode) )
--                return true ;
--            
--            Var v = Var.alloc(inputNode) ;
--            Node x = results.get(v) ;
--            if ( x != null )
--                return outputNode.equals(x) ;
--            
--            results.add(v, outputNode) ;
--            return true ;
--        }
--        
--        @Override
--        protected boolean hasNextBinding()
--        {
--            if ( finished ) return false ;
--            if ( slot != null ) return true ;
--            if ( cancelled )
--            {
--                graphIter.close() ;
--                finished = true ;
--                return false ;
--            }
--
--            while(graphIter.hasNext() && slot == null )
--            {
--                Row r = graphIter.next() ;
--                slot = mapper(r) ;
--            }
--            if ( slot == null )
--                finished = true ;
--            return slot != null ;
--        }
--
--        @Override
--        protected Binding moveToNextBinding()
--        {
--            if ( ! hasNextBinding() ) 
--                throw new ARQInternalErrorException() ;
--            Binding r = slot ;
--            slot = null ;
--            return r ;
--        }
--
--        @Override
--        protected void closeIterator()
--        {
--            if ( graphIter != null )
--                NiceIterator.close(graphIter) ;
--            graphIter = null ;
--        }
--        
--        @Override
--        protected void requestCancel()
--        {
--            // The QueryIteratorBase machinary will do the real work.
--            cancelled = true ;
--        }
--    }
--}
++/*
++ * 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 java.util.ArrayList;
++import java.util.List;
++
++import org.apache.jena.graph.Node ;
++import org.apache.jena.graph.Triple ;
++import org.apache.jena.propertytable.PropertyTable;
++import org.apache.jena.propertytable.Row;
++
++
++import org.apache.jena.sparql.ARQInternalErrorException ;
++import org.apache.jena.sparql.core.BasicPattern ;
++import org.apache.jena.sparql.core.Var ;
++import org.apache.jena.sparql.engine.ExecutionContext ;
++import org.apache.jena.sparql.engine.QueryIterator ;
++import org.apache.jena.sparql.engine.binding.Binding ;
++import org.apache.jena.sparql.engine.binding.BindingFactory ;
++import org.apache.jena.sparql.engine.binding.BindingMap ;
++import org.apache.jena.sparql.engine.iterator.QueryIter ;
++import org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply ;
++import org.apache.jena.util.iterator.ClosableIterator ;
++import org.apache.jena.util.iterator.ExtendedIterator ;
++import org.apache.jena.util.iterator.NiceIterator ;
++import org.apache.jena.util.iterator.WrappedIterator ;
++
++/**
++ * If the triple size within a BasicePattern is greater than 1 (i.e. at least 
2 triples), it's turned into a row querying.
++ *
++ */
++public class QueryIterPropertyTableRow  extends QueryIterRepeatApply{
++      
++      
++    private final BasicPattern pattern ;
++    
++    public QueryIterPropertyTableRow( QueryIterator input,
++                                   BasicPattern pattern , 
++                                   ExecutionContext cxt)
++    {
++        super(input, cxt) ;
++        this.pattern = pattern ;
++    }
++
++    @Override
++    protected QueryIterator nextStage(Binding binding)
++    {
++        return new RowMapper(binding, pattern, getExecContext()) ;
++    }
++    
++    static int countMapper = 0 ; 
++    static class RowMapper extends QueryIter
++    {   
++      private PropertyTable table;
++      
++      private BasicPattern pattern;
++        private Binding binding ;
++        private ClosableIterator<Row> graphIter ;
++        private Binding slot = null ;
++        private boolean finished = false ;
++        private volatile boolean cancelled = false ;
++
++        RowMapper(Binding binding, BasicPattern pattern, ExecutionContext cxt)
++        {
++            super(cxt) ;
++            GraphPropertyTable graph = 
(GraphPropertyTable)cxt.getActiveGraph() ;
++            
++            this.pattern = substitute(pattern, binding);
++            this.binding = binding ;
++            BasicPattern pattern2 = tripleNode(pattern);
++            
++            ExtendedIterator<Row> iter = graph.propertyTableBaseFind( new 
RowMatch( pattern2) );
++            
++            if ( false )
++            {
++                // Materialize the results now. Debugging only.
++                List<Row> x = iter.toList() ;
++                this.graphIter = WrappedIterator.create(x.iterator()) ;
++                iter.close();
++            }
++            else
++                // Stream.
++                this.graphIter = iter ;
++        }
++
++        private static Node tripleNode(Node node)
++        {
++            if ( node.isVariable() )
++                return Node.ANY ;
++            return node ;
++        }
++        
++        private static BasicPattern tripleNode(BasicPattern pattern)
++        {
++              List<Triple> triples = new ArrayList<Triple>();
++              for (Triple triple: pattern){
++                      triples.add( tripleNode(triple) );
++              }
++              return BasicPattern.wrap(triples);
++        }
++        
++        private static Triple tripleNode(Triple triple){
++            Node s = tripleNode(triple.getSubject()) ;
++            Node p = tripleNode(triple.getPredicate()) ;
++            Node o = tripleNode(triple.getObject()) ;
++            return Triple.create(s, p, o);
++        }
++
++        private static Node substitute(Node node, Binding binding)
++        {
++            if ( Var.isVar(node) )
++            {
++                Node x = binding.get(Var.alloc(node)) ;
++                if ( x != null )
++                    return x ;
++            }
++            return node ;
++        }
++        
++        private static Triple substitute(Triple triple, Binding binding){
++            Node s = substitute(triple.getSubject(), binding) ;
++            Node p = substitute(triple.getPredicate(), binding) ;
++            Node o = substitute(triple.getObject(), binding) ;
++            return Triple.create(s, p, o);
++        }
++        
++        private static BasicPattern substitute(BasicPattern pattern , Binding 
binding)
++        {
++              List<Triple> triples = new ArrayList<Triple>();
++              for (Triple triple: pattern){
++                      triples.add( substitute(triple,binding) );
++              }
++              return BasicPattern.wrap(triples);
++        }
++        
++        private Binding mapper(Row r)
++        {
++            BindingMap results = BindingFactory.create(binding) ;
++
++            if ( ! insert(pattern, r, results) )
++                return null ; 
++            return results ;
++        }
++        
++        private static boolean insert(BasicPattern input, Row output, 
BindingMap results)
++        {     
++              for (Triple triple: input){
++                      if (! insert(triple, output, results) ){
++                              return false;
++                      }
++              }
++              return true;
++        }
++        
++        private static boolean insert(Triple input, Row output, BindingMap 
results){
++              if ( ! insert(input.getSubject(), output.getRowKey(), results) )
++                return false ;
++//            if ( ! insert(input.getPredicate(), output.get, results) )
++//                return false ;
++            if ( ! insert(input.getObject(), output.getValue( 
input.getPredicate() ), results) )
++                return false ;
++            return true;
++        }
++
++        private static boolean insert(Node inputNode, Node outputNode, 
BindingMap results)
++        {
++            if ( ! Var.isVar(inputNode) )
++                return true ;
++            
++            Var v = Var.alloc(inputNode) ;
++            Node x = results.get(v) ;
++            if ( x != null )
++                return outputNode.equals(x) ;
++            
++            results.add(v, outputNode) ;
++            return true ;
++        }
++        
++        @Override
++        protected boolean hasNextBinding()
++        {
++            if ( finished ) return false ;
++            if ( slot != null ) return true ;
++            if ( cancelled )
++            {
++                graphIter.close() ;
++                finished = true ;
++                return false ;
++            }
++
++            while(graphIter.hasNext() && slot == null )
++            {
++                Row r = graphIter.next() ;
++                slot = mapper(r) ;
++            }
++            if ( slot == null )
++                finished = true ;
++            return slot != null ;
++        }
++
++        @Override
++        protected Binding moveToNextBinding()
++        {
++            if ( ! hasNextBinding() ) 
++                throw new ARQInternalErrorException() ;
++            Binding r = slot ;
++            slot = null ;
++            return r ;
++        }
++
++        @Override
++        protected void closeIterator()
++        {
++            if ( graphIter != null )
++                NiceIterator.close(graphIter) ;
++            graphIter = null ;
++        }
++        
++        @Override
++        protected void requestCancel()
++        {
++            // The QueryIteratorBase machinary will do the real work.
++            cancelled = true ;
++        }
++    }
++}

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/graph/RowMatch.java
----------------------------------------------------------------------
diff --cc 
jena-csv/src/main/java/org/apache/jena/propertytable/graph/RowMatch.java
index 971438b,971438b..f5b9c18
--- a/jena-csv/src/main/java/org/apache/jena/propertytable/graph/RowMatch.java
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/graph/RowMatch.java
@@@ -1,48 -1,48 +1,48 @@@
--/*
-- * 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.graph.Node ;
--import org.apache.jena.sparql.core.BasicPattern ;
--
--/**
-- * The data structure for matching a Row
-- *
-- */
--public class RowMatch {
--      
--      private BasicPattern pattern;
--      
--      public RowMatch( BasicPattern pattern ){                
--              this.pattern=pattern;
--      }
--
--      public Node getMatchSubject(){
--              return pattern.get(0).getMatchSubject();
--      }
--      
--      public Node getSubject(){
--              return pattern.get(0).getSubject();
--      }
--      
--      public BasicPattern getBasicPattern(){
--              return pattern;
--      }
--
--}
++/*
++ * 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.graph.Node ;
++import org.apache.jena.sparql.core.BasicPattern ;
++
++/**
++ * The data structure for matching a Row
++ *
++ */
++public class RowMatch {
++      
++      private BasicPattern pattern;
++      
++      public RowMatch( BasicPattern pattern ){                
++              this.pattern=pattern;
++      }
++
++      public Node getMatchSubject(){
++              return pattern.get(0).getMatchSubject();
++      }
++      
++      public Node getSubject(){
++              return pattern.get(0).getSubject();
++      }
++      
++      public BasicPattern getBasicPattern(){
++              return pattern;
++      }
++
++}

http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-csv/src/main/java/org/apache/jena/propertytable/graph/StageGeneratorPropertyTable.java
----------------------------------------------------------------------
diff --cc 
jena-csv/src/main/java/org/apache/jena/propertytable/graph/StageGeneratorPropertyTable.java
index 53df0c9,53df0c9..4692472
--- 
a/jena-csv/src/main/java/org/apache/jena/propertytable/graph/StageGeneratorPropertyTable.java
+++ 
b/jena-csv/src/main/java/org/apache/jena/propertytable/graph/StageGeneratorPropertyTable.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.graph;
--
--
--import org.apache.jena.graph.Graph ;
--import org.apache.jena.sparql.core.BasicPattern ;
--import org.apache.jena.sparql.engine.ExecutionContext ;
--import org.apache.jena.sparql.engine.QueryIterator ;
--import org.apache.jena.sparql.engine.main.StageGenerator ;
--
--/**
-- *  The extension of StageGenerator for querying a Row.
-- *
-- */
--public class StageGeneratorPropertyTable implements StageGenerator {
--
--    // Using OpExecutor is preferred.
--    StageGenerator above = null ;
--    
--    public StageGeneratorPropertyTable(StageGenerator original)
--    {
--        above = original ;
--    }
--    
--    @Override
--    public QueryIterator execute(BasicPattern pattern, QueryIterator input, 
ExecutionContext execCxt)
--    {
--        // --- In case this isn't for GraphPropertyTable
--        Graph g = execCxt.getActiveGraph() ;
--        
--        if ( ! ( g instanceof GraphPropertyTable ) )
--            return above.execute(pattern, input, execCxt) ;
--        if (pattern.size() <= 1){
--              return above.execute(pattern, input, execCxt) ;
--        }
--        return QueryIterPropertyTable.create(input, pattern, execCxt);
--    }
--    
--
--}
++/*
++ * 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.graph.Graph ;
++import org.apache.jena.sparql.core.BasicPattern ;
++import org.apache.jena.sparql.engine.ExecutionContext ;
++import org.apache.jena.sparql.engine.QueryIterator ;
++import org.apache.jena.sparql.engine.main.StageGenerator ;
++
++/**
++ *  The extension of StageGenerator for querying a Row.
++ *
++ */
++public class StageGeneratorPropertyTable implements StageGenerator {
++
++    // Using OpExecutor is preferred.
++    StageGenerator above = null ;
++    
++    public StageGeneratorPropertyTable(StageGenerator original)
++    {
++        above = original ;
++    }
++    
++    @Override
++    public QueryIterator execute(BasicPattern pattern, QueryIterator input, 
ExecutionContext execCxt)
++    {
++        // --- In case this isn't for GraphPropertyTable
++        Graph g = execCxt.getActiveGraph() ;
++        
++        if ( ! ( g instanceof GraphPropertyTable ) )
++            return above.execute(pattern, input, execCxt) ;
++        if (pattern.size() <= 1){
++              return above.execute(pattern, input, execCxt) ;
++        }
++        return QueryIterPropertyTable.create(input, pattern, execCxt);
++    }
++    
++
++}

Reply via email to