Move jena-csv code to intended location

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

Branch: refs/heads/master
Commit: e7ac8b4d5be932199eac5c2c90c7c40a60dd9572
Parents: a40c568
Author: Rob Vesse <[email protected]>
Authored: Wed Oct 1 16:06:25 2014 +0100
Committer: Rob Vesse <[email protected]>
Committed: Wed Oct 1 16:08:52 2014 +0100

----------------------------------------------------------------------
 LICENSE                                         | 202 -----------
 NOTICE                                          |   5 -
 ReleaseNotes.txt                                |  14 -
 jena-csv/LICENSE                                | 202 +++++++++++
 jena-csv/NOTICE                                 |   5 +
 jena-csv/ReleaseNotes.txt                       |  14 +
 jena-csv/pom.xml                                | 189 ++++++++++
 .../org/apache/jena/propertytable/Column.java   |  45 +++
 .../jena/propertytable/PropertyTable.java       | 126 +++++++
 .../java/org/apache/jena/propertytable/Row.java |  75 ++++
 .../jena/propertytable/graph/GraphCSV.java      |  62 ++++
 .../propertytable/graph/GraphPropertyTable.java | 203 +++++++++++
 .../graph/QueryIterPropertyTable.java           | 115 ++++++
 .../graph/QueryIterPropertyTableRow.java        | 243 +++++++++++++
 .../jena/propertytable/graph/RowMatch.java      |  48 +++
 .../graph/StageGeneratorPropertyTable.java      |  57 +++
 .../jena/propertytable/impl/ColumnImpl.java     |  58 +++
 .../impl/PropertyTableArrayImpl.java            | 346 ++++++++++++++++++
 .../impl/PropertyTableBuilder.java              | 134 +++++++
 .../impl/PropertyTableHashMapImpl.java          | 357 +++++++++++++++++++
 .../apache/jena/propertytable/lang/LangCSV.java | 229 ++++++++++++
 .../apache/jena/propertytable/util/IRILib.java  | 264 ++++++++++++++
 .../main/java/riotcmd/LocatorOupputFile.java    | 148 ++++++++
 jena-csv/src/main/java/riotcmd/ModDest.java     |  51 +++
 jena-csv/src/main/java/riotcmd/csv2rdf.java     | 205 +++++++++++
 .../jena/propertytable/AbstractColumnTest.java  |  80 +++++
 .../AbstractPropertyTableTest.java              |  57 +++
 .../jena/propertytable/AbstractRowTest.java     | 106 ++++++
 .../org/apache/jena/propertytable/BaseTest.java |  47 +++
 .../jena/propertytable/TS_PropertyTable.java    |  42 +++
 .../jena/propertytable/graph/GraphCSVTest.java  | 153 ++++++++
 .../impl/AbstractPropertyTableBuilderTest.java  | 147 ++++++++
 .../impl/PropertyTableArrayImplTest.java        |  84 +++++
 .../PropertyTableBuilderForArrayImplTest.java   |  39 ++
 .../PropertyTableBuilderForHashMapImplTest.java |  34 ++
 .../impl/PropertyTableHashMapImplTest.java      |  46 +++
 .../jena/propertytable/lang/TestLangCSV.java    | 113 ++++++
 .../HEFCE_organogram_senior_data_31032011.csv   |   5 +
 .../test/resources/PLOSone-search-results.csv   |   6 +
 jena-csv/src/test/resources/Palo_Alto_Trees.csv |   6 +
 jena-csv/src/test/resources/log4j.properties    |  19 +
 jena-csv/src/test/resources/test.csv            |   3 +
 pom.xml                                         | 189 ----------
 .../org/apache/jena/propertytable/Column.java   |  45 ---
 .../jena/propertytable/PropertyTable.java       | 126 -------
 .../java/org/apache/jena/propertytable/Row.java |  75 ----
 .../jena/propertytable/graph/GraphCSV.java      |  62 ----
 .../propertytable/graph/GraphPropertyTable.java | 203 -----------
 .../graph/QueryIterPropertyTable.java           | 115 ------
 .../graph/QueryIterPropertyTableRow.java        | 243 -------------
 .../jena/propertytable/graph/RowMatch.java      |  48 ---
 .../graph/StageGeneratorPropertyTable.java      |  57 ---
 .../jena/propertytable/impl/ColumnImpl.java     |  58 ---
 .../impl/PropertyTableArrayImpl.java            | 346 ------------------
 .../impl/PropertyTableBuilder.java              | 134 -------
 .../impl/PropertyTableHashMapImpl.java          | 357 -------------------
 .../apache/jena/propertytable/lang/LangCSV.java | 229 ------------
 .../apache/jena/propertytable/util/IRILib.java  | 264 --------------
 src/main/java/riotcmd/LocatorOupputFile.java    | 148 --------
 src/main/java/riotcmd/ModDest.java              |  51 ---
 src/main/java/riotcmd/csv2rdf.java              | 205 -----------
 .../jena/propertytable/AbstractColumnTest.java  |  80 -----
 .../AbstractPropertyTableTest.java              |  57 ---
 .../jena/propertytable/AbstractRowTest.java     | 106 ------
 .../org/apache/jena/propertytable/BaseTest.java |  47 ---
 .../jena/propertytable/TS_PropertyTable.java    |  42 ---
 .../jena/propertytable/graph/GraphCSVTest.java  | 153 --------
 .../impl/AbstractPropertyTableBuilderTest.java  | 147 --------
 .../impl/PropertyTableArrayImplTest.java        |  84 -----
 .../PropertyTableBuilderForArrayImplTest.java   |  39 --
 .../PropertyTableBuilderForHashMapImplTest.java |  34 --
 .../impl/PropertyTableHashMapImplTest.java      |  46 ---
 .../jena/propertytable/lang/TestLangCSV.java    | 113 ------
 .../HEFCE_organogram_senior_data_31032011.csv   |   5 -
 src/test/resources/PLOSone-search-results.csv   |   6 -
 src/test/resources/Palo_Alto_Trees.csv          |   6 -
 src/test/resources/log4j.properties             |  19 -
 src/test/resources/test.csv                     |   3 -
 78 files changed, 4163 insertions(+), 4163 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/e7ac8b4d/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.

http://git-wip-us.apache.org/repos/asf/jena/blob/e7ac8b4d/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
deleted file mode 100644
index ca5166a..0000000
--- a/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Jena - Data Tables for RDF and SPARQL
-Copyright 2011, 2012, 2013, 2014 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).

http://git-wip-us.apache.org/repos/asf/jena/blob/e7ac8b4d/ReleaseNotes.txt
----------------------------------------------------------------------
diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt
deleted file mode 100644
index 58688df..0000000
--- a/ReleaseNotes.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Release Notes 
-=============
-
-==== Apache Jena - CSV PropertyTable 1.0.0
-
-+ PropertyTable and its 2 implementations:
-    PropertyTableArrayImpl
-    PropertyTableHashMapImpl
-+ GraphPropertyTable and StageGenerator Optimization
-+ RIOT Reader for CSV Files
-+ CSV2RDF tool
-
-
-

http://git-wip-us.apache.org/repos/asf/jena/blob/e7ac8b4d/jena-csv/LICENSE
----------------------------------------------------------------------
diff --git a/jena-csv/LICENSE b/jena-csv/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/jena-csv/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

http://git-wip-us.apache.org/repos/asf/jena/blob/e7ac8b4d/jena-csv/NOTICE
----------------------------------------------------------------------
diff --git a/jena-csv/NOTICE b/jena-csv/NOTICE
new file mode 100644
index 0000000..ca5166a
--- /dev/null
+++ b/jena-csv/NOTICE
@@ -0,0 +1,5 @@
+Apache Jena - Data Tables for RDF and SPARQL
+Copyright 2011, 2012, 2013, 2014 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).

http://git-wip-us.apache.org/repos/asf/jena/blob/e7ac8b4d/jena-csv/ReleaseNotes.txt
----------------------------------------------------------------------
diff --git a/jena-csv/ReleaseNotes.txt b/jena-csv/ReleaseNotes.txt
new file mode 100644
index 0000000..58688df
--- /dev/null
+++ b/jena-csv/ReleaseNotes.txt
@@ -0,0 +1,14 @@
+Release Notes 
+=============
+
+==== Apache Jena - CSV PropertyTable 1.0.0
+
++ PropertyTable and its 2 implementations:
+    PropertyTableArrayImpl
+    PropertyTableHashMapImpl
++ GraphPropertyTable and StageGenerator Optimization
++ RIOT Reader for CSV Files
++ CSV2RDF tool
+
+
+

http://git-wip-us.apache.org/repos/asf/jena/blob/e7ac8b4d/jena-csv/pom.xml
----------------------------------------------------------------------
diff --git a/jena-csv/pom.xml b/jena-csv/pom.xml
new file mode 100644
index 0000000..2ba7acc
--- /dev/null
+++ b/jena-csv/pom.xml
@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.jena</groupId>
+  <artifactId>jena-csv</artifactId>
+  <packaging>jar</packaging>
+  <name>Apache Jena - Data Tables for RDF and SPARQL</name>
+  <version>1.0.1-SNAPSHOT</version>
+
+  <parent>
+    <groupId>org.apache.jena</groupId>
+    <artifactId>jena-parent</artifactId>
+    <version>10</version>
+    <relativePath />
+  </parent>
+  
+  
+    <!-- Need if the parent is a snapshot -->
+  <repositories>
+    <repository>
+      <id>apache.snapshots</id>
+      <name>Apache Snapshot Repository</name>
+      <url>http://repository.apache.org/snapshots</url>
+      <releases>
+       <enabled>false</enabled>
+      </releases>
+    </repository>
+  </repositories>
+  
+  <description>jena-csv is for getting CSVs into a form that is amenable to 
Jena SPARQL processing, and doing so in a way that is not specific to CSV 
files. It includes getting the right architecture in place for regular table 
shaped data, using the core abstraction of PropertyTable.</description> 
+  
+  <scm>
+    
<connection>scm:svn:https://svn.apache.org/repos/asf/jena/Experimental/jena-csv</connection>
+    
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/jena/Experimental/jena-csv</developerConnection>
+    <url>https://svn.apache.org/repos/asf/jena/Experimental/jena-csv</url>
+  </scm>
+  
+  <properties>
+    
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format>
+    <build.time.xsd>${maven.build.timestamp}</build.time.xsd>
+  </properties>
+
+  <dependencies>
+
+    <!-- All Jena libs -->
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>apache-jena-libs</artifactId>
+      <version>2.12.0</version>
+      <type>pom</type>
+    </dependency>
+    
+    <!-- Google Code Guava -->
+    <dependency>
+         <groupId>com.google.guava</groupId>
+         <artifactId>guava</artifactId>
+         <version>17.0</version>
+    </dependency>
+       
+    <!-- Testing support -->
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-arq</artifactId>
+      <version>2.12.0</version>
+      <type>jar</type>
+      <classifier>tests</classifier>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  
+  
+
+  <build>
+    <plugins>
+      <plugin>
+       <groupId>org.apache.maven.plugins</groupId>
+       <artifactId>maven-compiler-plugin</artifactId>
+      </plugin>
+
+      <plugin>
+       <groupId>org.apache.maven.plugins</groupId>
+       <artifactId>maven-surefire-plugin</artifactId>
+       <configuration>
+         <systemPropertyVariables>
+           
<log4j.configuration>file:src/test/resources/log4j.properties</log4j.configuration>
+         </systemPropertyVariables>
+
+         <includes>
+           <include>**/TS_*.java</include>
+         </includes>
+       </configuration>
+      </plugin>
+
+      <plugin>
+       <groupId>org.apache.maven.plugins</groupId>
+       <artifactId>maven-jar-plugin</artifactId>
+      </plugin>
+
+      <plugin>
+       <groupId>org.apache.maven.plugins</groupId>
+       <artifactId>maven-source-plugin</artifactId>
+       <executions>
+         <execution>
+           <id>attach-sources</id>
+           <goals>
+             <goal>jar-no-fork</goal>
+           </goals>
+         </execution>
+         <!-- Only material in the main jar <execution> 
<id>attach-sources-test</id> 
+              <goals> <goal>test-jar-no-fork</goal> </goals> </execution> -->
+       </executions>
+      </plugin>
+
+      <plugin>
+       <groupId>org.apache.maven.plugins</groupId>
+       <artifactId>maven-javadoc-plugin</artifactId>
+       <configuration>
+         <version>true</version>
+         <show>public</show>
+         <quiet>true</quiet>
+         <encoding>UTF-8</encoding>
+         <windowtitle>${project.name} ${project.version}</windowtitle>
+         <doctitle>${project.name} ${project.version}</doctitle>
+         <bottom>Licenced under the Apache License, Version 2.0</bottom>
+       </configuration>
+      </plugin>
+
+      <plugin>
+       <groupId>org.apache.maven.plugins</groupId>
+       <artifactId>maven-resources-plugin</artifactId>
+       <configuration>
+         <encoding>UTF-8</encoding>
+       </configuration>
+      </plugin>
+
+      <plugin>
+       <groupId>org.apache.maven.plugins</groupId>
+       <artifactId>maven-dependency-plugin</artifactId>
+       <configuration>
+         <overWriteReleases>false</overWriteReleases>
+         <overWriteIfNewer>true</overWriteIfNewer>
+       </configuration>
+      </plugin>
+      <plugin>
+       <groupId>org.apache.maven.plugins</groupId>
+       <artifactId>maven-eclipse-plugin</artifactId>
+       <configuration>
+         <!-- By default, have separate Eclipse and maven build areas -->
+         
<buildOutputDirectory>${project.build.directory}/classes</buildOutputDirectory>
+         <downloadSources>true</downloadSources>
+         <downloadJavadocs>false</downloadJavadocs>
+       </configuration>
+      </plugin>
+
+      <plugin>
+       <groupId>org.apache.maven.plugins</groupId>
+       <artifactId>maven-release-plugin</artifactId>
+    <configuration>
+         <tagBase>https://svn.apache.org/repos/asf/jena/tags/</tagBase>  
+       </configuration>
+      </plugin>
+    </plugins>
+
+  </build>
+   
+</project>

http://git-wip-us.apache.org/repos/asf/jena/blob/e7ac8b4d/jena-csv/src/main/java/org/apache/jena/propertytable/Column.java
----------------------------------------------------------------------
diff --git a/jena-csv/src/main/java/org/apache/jena/propertytable/Column.java 
b/jena-csv/src/main/java/org/apache/jena/propertytable/Column.java
new file mode 100644
index 0000000..2e6b6b2
--- /dev/null
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/Column.java
@@ -0,0 +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 com.hp.hpl.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/e7ac8b4d/jena-csv/src/main/java/org/apache/jena/propertytable/PropertyTable.java
----------------------------------------------------------------------
diff --git 
a/jena-csv/src/main/java/org/apache/jena/propertytable/PropertyTable.java 
b/jena-csv/src/main/java/org/apache/jena/propertytable/PropertyTable.java
new file mode 100644
index 0000000..6c9b9a8
--- /dev/null
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/PropertyTable.java
@@ -0,0 +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 com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.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/e7ac8b4d/jena-csv/src/main/java/org/apache/jena/propertytable/Row.java
----------------------------------------------------------------------
diff --git a/jena-csv/src/main/java/org/apache/jena/propertytable/Row.java 
b/jena-csv/src/main/java/org/apache/jena/propertytable/Row.java
new file mode 100644
index 0000000..bc6d068
--- /dev/null
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/Row.java
@@ -0,0 +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 com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.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/e7ac8b4d/jena-csv/src/main/java/org/apache/jena/propertytable/graph/GraphCSV.java
----------------------------------------------------------------------
diff --git 
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
new file mode 100644
index 0000000..d002ec6
--- /dev/null
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/graph/GraphCSV.java
@@ -0,0 +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));
+       }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/e7ac8b4d/jena-csv/src/main/java/org/apache/jena/propertytable/graph/GraphPropertyTable.java
----------------------------------------------------------------------
diff --git 
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
new file mode 100644
index 0000000..3f1e930
--- /dev/null
+++ 
b/jena-csv/src/main/java/org/apache/jena/propertytable/graph/GraphPropertyTable.java
@@ -0,0 +1,203 @@
+/*
+ * 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 org.apache.jena.propertytable.Column;
+import org.apache.jena.propertytable.PropertyTable;
+import org.apache.jena.propertytable.Row;
+
+
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.NodeFactory;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.graph.TripleMatch;
+import com.hp.hpl.jena.graph.impl.GraphBase;
+import com.hp.hpl.jena.sparql.core.BasicPattern;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+import com.hp.hpl.jena.util.iterator.Filter;
+import com.hp.hpl.jena.util.iterator.NullIterator;
+import com.hp.hpl.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(TripleMatch m) {
+               //System.out.println(m);
+
+               if (this.pt == null) {
+                       return NullIterator.instance();
+               }
+
+               ExtendedIterator<Triple> iter = null;
+
+               Node s = m.getMatchSubject();
+               Node p = m.getMatchPredicate();
+               Node o = m.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(m.asTriple()));
+
+       }
+       
+       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 extends Filter<Row> {
+               final protected RowMatch rMatch;
+
+               public RowMatchFilterEquality(RowMatch rMatch) {
+                       this.rMatch = rMatch;
+               }
+
+               @Override
+               public boolean accept(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 extends Filter<Triple> {
+               final protected Triple tMatch;
+
+               /** Creates new TripleMatchFilter */
+               public TripleMatchFilterEquality(Triple tMatch) {
+                       this.tMatch = tMatch;
+               }
+
+               @Override
+               public boolean accept(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/e7ac8b4d/jena-csv/src/main/java/org/apache/jena/propertytable/graph/QueryIterPropertyTable.java
----------------------------------------------------------------------
diff --git 
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
new file mode 100644
index 0000000..9b13e6c
--- /dev/null
+++ 
b/jena-csv/src/main/java/org/apache/jena/propertytable/graph/QueryIterPropertyTable.java
@@ -0,0 +1,115 @@
+/*
+ * 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 com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.sparql.core.BasicPattern;
+import com.hp.hpl.jena.sparql.engine.ExecutionContext;
+import com.hp.hpl.jena.sparql.engine.QueryIterator;
+import com.hp.hpl.jena.sparql.engine.binding.Binding;
+import com.hp.hpl.jena.sparql.engine.iterator.QueryIter1;
+import com.hp.hpl.jena.sparql.serializer.SerializationContext;
+import com.hp.hpl.jena.sparql.util.FmtUtils;
+import com.hp.hpl.jena.sparql.util.Utils;
+
+/**
+ * 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(Utils.className(this));
+               out.println();
+               out.incIndent();
+               FmtUtils.formatPattern(out, pattern, sCxt);
+               out.decIndent();
+       }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/e7ac8b4d/jena-csv/src/main/java/org/apache/jena/propertytable/graph/QueryIterPropertyTableRow.java
----------------------------------------------------------------------
diff --git 
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
new file mode 100644
index 0000000..a479e25
--- /dev/null
+++ 
b/jena-csv/src/main/java/org/apache/jena/propertytable/graph/QueryIterPropertyTableRow.java
@@ -0,0 +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.propertytable.PropertyTable;
+import org.apache.jena.propertytable.Row;
+
+
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.sparql.ARQInternalErrorException;
+import com.hp.hpl.jena.sparql.core.BasicPattern;
+import com.hp.hpl.jena.sparql.core.Var;
+import com.hp.hpl.jena.sparql.engine.ExecutionContext;
+import com.hp.hpl.jena.sparql.engine.QueryIterator;
+import com.hp.hpl.jena.sparql.engine.binding.Binding;
+import com.hp.hpl.jena.sparql.engine.binding.BindingFactory;
+import com.hp.hpl.jena.sparql.engine.binding.BindingMap;
+import com.hp.hpl.jena.sparql.engine.iterator.QueryIter;
+import com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply;
+import com.hp.hpl.jena.util.iterator.ClosableIterator;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+import com.hp.hpl.jena.util.iterator.NiceIterator;
+import com.hp.hpl.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/e7ac8b4d/jena-csv/src/main/java/org/apache/jena/propertytable/graph/RowMatch.java
----------------------------------------------------------------------
diff --git 
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
new file mode 100644
index 0000000..15fe088
--- /dev/null
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/graph/RowMatch.java
@@ -0,0 +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 com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.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/e7ac8b4d/jena-csv/src/main/java/org/apache/jena/propertytable/graph/StageGeneratorPropertyTable.java
----------------------------------------------------------------------
diff --git 
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
new file mode 100644
index 0000000..9c3457b
--- /dev/null
+++ 
b/jena-csv/src/main/java/org/apache/jena/propertytable/graph/StageGeneratorPropertyTable.java
@@ -0,0 +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 com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.sparql.core.BasicPattern;
+import com.hp.hpl.jena.sparql.engine.ExecutionContext;
+import com.hp.hpl.jena.sparql.engine.QueryIterator;
+import com.hp.hpl.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);
+    }
+    
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/e7ac8b4d/jena-csv/src/main/java/org/apache/jena/propertytable/impl/ColumnImpl.java
----------------------------------------------------------------------
diff --git 
a/jena-csv/src/main/java/org/apache/jena/propertytable/impl/ColumnImpl.java 
b/jena-csv/src/main/java/org/apache/jena/propertytable/impl/ColumnImpl.java
new file mode 100644
index 0000000..f846aee
--- /dev/null
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/impl/ColumnImpl.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.propertytable.impl;
+
+
+import java.util.List;
+
+import org.apache.jena.propertytable.Column;
+import org.apache.jena.propertytable.PropertyTable;
+
+import com.hp.hpl.jena.graph.Node;
+
+/**
+ * The simple implementation of Column
+ *
+ */
+public class ColumnImpl implements Column {
+       
+       
+       private final PropertyTable table;
+       private Node p;
+
+       ColumnImpl(PropertyTable table, Node p) {
+               this.table = table;
+               this.p = p;
+       }
+
+       @Override
+       public PropertyTable getTable() {
+               return table;
+       }
+
+       @Override
+       public Node getColumnKey() {
+               return p;
+       }
+
+       @Override
+       public List<Node> getValues() {
+               return table.getColumnValues(this);
+       }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/e7ac8b4d/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableArrayImpl.java
----------------------------------------------------------------------
diff --git 
a/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableArrayImpl.java
 
b/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableArrayImpl.java
new file mode 100644
index 0000000..b8e2708
--- /dev/null
+++ 
b/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableArrayImpl.java
@@ -0,0 +1,346 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.propertytable.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.jena.atlas.iterator.Iter;
+import org.apache.jena.atlas.iterator.IteratorConcat;
+import org.apache.jena.propertytable.Column;
+import org.apache.jena.propertytable.PropertyTable;
+import org.apache.jena.propertytable.Row;
+
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+import com.hp.hpl.jena.util.iterator.WrappedIterator;
+
+/**
+ * A PropertyTable Implementation using a two dimension array.
+ * It contains SPO and PSO indexes.
+ * 
+ */
+public class PropertyTableArrayImpl implements PropertyTable {
+       
+       private final List<Node> rowList;
+       private final List<Node> columnList;
+
+       private final Map<Node, Integer> rowKeyToIndex;
+       private final Map<Node, Integer> columnKeyToIndex;
+       private final Node[][] array;
+       private final int rowNum;
+       private final int columnNum;
+       
+       public PropertyTableArrayImpl(int rowNum, int columnNum){
+               rowList = new ArrayList<Node>(rowNum);
+               columnList = new ArrayList<Node>(columnNum);
+               rowKeyToIndex = new HashMap<Node, Integer>();
+               columnKeyToIndex = new HashMap<Node, Integer>();
+               this.rowNum = rowNum;
+               this.columnNum = columnNum;
+               array = new Node [rowNum][columnNum];
+       }
+
+       @Override
+       public ExtendedIterator<Triple> getTripleIterator(Column column, Node 
value) {
+               if (column == null || column.getColumnKey() == null)
+                       throw new NullPointerException("column is null");
+               
+               if (value == null){
+                       throw new NullPointerException("value is null");
+               }
+               
+               ArrayList<Triple> triples = new ArrayList<Triple>();
+               
+               Node p = column.getColumnKey();
+               Integer columnIndex = this.columnKeyToIndex.get(p);
+               if (columnIndex != null){
+                       for(int rowIndex=0; rowIndex< 
rowList.size();rowIndex++){
+                               if ( value.equals( this.get(rowIndex, 
columnIndex))){
+                                       
triples.add(Triple.create(rowList.get(rowIndex), p, value));
+                               }
+                       }
+               }
+               return WrappedIterator.create(triples.iterator());
+       }
+
+       @Override
+       public ExtendedIterator<Triple> getTripleIterator(Column column) {
+               
+               if (column == null || column.getColumnKey() == null)
+                       throw new NullPointerException("column is null");
+               
+               ArrayList<Triple> triples = new ArrayList<Triple>();
+               
+               Node p = column.getColumnKey();
+               Integer columnIndex = this.columnKeyToIndex.get(p);
+               if (columnIndex != null){
+                       for(int rowIndex=0; rowIndex< 
rowList.size();rowIndex++){
+                               if(this.get(rowIndex, columnIndex)!=null){
+                                       
triples.add(Triple.create(rowList.get(rowIndex), p, this.get(rowIndex, 
columnIndex)));
+                               }
+                       }
+               }
+               return WrappedIterator.create(triples.iterator());
+       }
+
+       @Override
+       public ExtendedIterator<Triple> getTripleIterator(Node value) {
+               if (value == null)
+                       throw new NullPointerException("value is null");
+               
+               IteratorConcat<Triple> iter = new IteratorConcat<Triple>();
+               for (Column column : this.getColumns()) {
+                       ExtendedIterator<Triple> eIter = 
getTripleIterator(column,value);
+                       iter.add(eIter);
+               }
+               return WrappedIterator.create(Iter.distinct(iter));
+       }
+
+       @Override
+       public ExtendedIterator<Triple> getTripleIterator(Row row) {
+               if (row == null || row.getRowKey() == null)
+                       throw new NullPointerException("row is null");
+               
+               ArrayList<Triple> triples = new ArrayList<Triple>();
+           Integer rowIndex = this.rowKeyToIndex.get(row.getRowKey());
+
+               if (rowIndex != null){
+                       for(int columnIndex=0; columnIndex < columnList.size(); 
columnIndex++){
+                               triples.add(Triple.create( row.getRowKey(), 
columnList.get(columnIndex), this.get(rowIndex, columnIndex)));
+                       }
+               }
+               return WrappedIterator.create(triples.iterator());
+       }
+
+       @Override
+       public ExtendedIterator<Triple> getTripleIterator() {
+
+               IteratorConcat<Triple> iter = new IteratorConcat<Triple>();
+               for (Column column : getColumns()) {
+                       iter.add(getTripleIterator(column));
+               }
+               return WrappedIterator.create(Iter.distinct(iter));
+       }
+
+       @Override
+       public Collection<Column> getColumns() {
+               Collection<Column> columns = new ArrayList<Column>();
+               for(Node p: columnKeyToIndex.keySet() ){
+                       columns.add(new ColumnImpl(this, p));
+               }
+               return columns;
+       }
+
+       @Override
+       public Column getColumn(Node p) {
+               if (p == null)
+                       throw new NullPointerException("column name is null");
+           Integer columnIndex = columnKeyToIndex.get(p);
+           return (columnIndex == null)
+               ? null : new ColumnImpl(this, p);
+       }
+
+       @Override
+       public Column createColumn(Node p) {
+               if (p == null)
+                       throw new NullPointerException("column name is null");
+
+               if (columnKeyToIndex.containsKey(p))
+                       throw new IllegalArgumentException("column already 
exists: '"
+                                       + p.toString());
+               
+               if (columnList.size()>= columnNum)
+                       throw new IllegalArgumentException("cannot create new 
column for max column count: " + columnNum);
+               
+               columnList.add(p);
+               columnKeyToIndex.put(p, columnList.indexOf(p));
+               return getColumn(p);
+       }
+
+       @Override
+       public Row getRow(Node s) {
+               if (s == null)
+                       throw new NullPointerException("subject node is null");
+               
+               Integer rowIndex = rowKeyToIndex.get(s);
+               return (rowIndex == null) ? null : new InternalRow(rowIndex);
+       }
+
+       @Override
+       public Row createRow(Node s) {
+               Row row = this.getRow(s);
+               if (row != null)
+                       return row;
+
+               if (rowList.size()>= rowNum)
+                       throw new IllegalArgumentException("cannot create new 
row for max row count: " + rowNum);
+               
+               rowList.add(s);
+               int rowIndex = rowList.indexOf(s);
+               rowKeyToIndex.put(s, rowIndex);         
+               
+               return new InternalRow(rowIndex);
+       }
+       
+       private void set(int rowIndex, int columnIndex, Node value) {
+               
+               if (rowIndex >= rowList.size())
+                       throw new IllegalArgumentException("row index out of 
bound: " + rowList.size());
+               if (columnIndex >= columnList.size())
+                       throw new IllegalArgumentException("column index out of 
bound: " + columnList.size());
+               array[rowIndex][columnIndex] = value;
+       }
+       
+       public Node get(int rowIndex, int columnIndex) {
+           if (rowIndex >= rowList.size())
+                       throw new IllegalArgumentException("row index out of 
bound: " + rowList.size());
+               if (columnIndex >= columnList.size())
+                       throw new IllegalArgumentException("column index out of 
bound: " + columnList.size());
+               return array[rowIndex][columnIndex];
+    }
+
+       @Override
+       public List<Row> getAllRows() {
+               ArrayList<Row> rows = new ArrayList<Row>();
+               for (int rowIndex=0;rowIndex<rowList.size();rowIndex++){
+                       rows.add( new InternalRow(rowIndex));
+               }
+               return rows;
+       }
+
+       @Override
+       public List<Node> getColumnValues(Column column) {
+               if (column == null || column.getColumnKey() == null)
+                       throw new NullPointerException("column is null");
+               
+               Node p = column.getColumnKey();
+               Integer columnIndex = this.columnKeyToIndex.get(p);
+               
+               List<Node> list = new ArrayList<Node>();
+               
+               if (columnIndex != null){
+                       for(int rowIndex=0; rowIndex< 
rowList.size();rowIndex++){
+                               if(this.get(rowIndex, columnIndex)!=null){
+                                       list.add(this.get(rowIndex, 
columnIndex));
+                               }
+                       }
+               }
+               return list;
+       }
+       
+
+       @Override
+       public Collection<Row> getMatchingRows(Column column, Node value) {
+               
+               if (column == null || column.getColumnKey() == null)
+                       throw new NullPointerException("column is null");
+               
+               if (value == null){
+                       throw new NullPointerException("value is null");
+               }
+               
+               final ArrayList<Row> matchingRows = new ArrayList<Row>();
+               
+               Node p = column.getColumnKey();
+               Integer columnIndex = this.columnKeyToIndex.get(p);
+               if (columnIndex != null){
+                       for(int rowIndex=0; rowIndex< 
rowList.size();rowIndex++){
+                               if ( value.equals( this.get(rowIndex, 
columnIndex))){
+                                       matchingRows.add( this.getRow( 
rowList.get(rowIndex) ));
+                               }
+                       }
+               }
+               return matchingRows;
+       }
+       
+       private final class InternalRow implements Row {
+
+           final int rowIndex;
+
+           InternalRow(int rowIndex) {
+             this.rowIndex = rowIndex;
+           }
+               
+               @Override
+               public PropertyTable getTable() {
+                       return PropertyTableArrayImpl.this;
+               }
+
+               @Override
+               public void setValue(Column column, Node value) {
+                       if (column == null || column.getColumnKey() == null)
+                               throw new NullPointerException("column is 
null");
+                       
+                   Integer columnIndex = 
columnKeyToIndex.get(column.getColumnKey());
+                   if (columnIndex == null)
+                       throw new IllegalArgumentException("column index does 
not exist: " + column.getColumnKey());
+
+                   set(rowIndex, columnIndex, value);
+                       
+               }
+
+               @Override
+               public Node getValue(Column column) {
+                       if (column == null)
+                               throw new NullPointerException("column is 
null");
+                       return this.getValue(column.getColumnKey());
+               }
+
+               @Override
+               public Node getValue(Node columnKey) {
+                       if (columnKey == null)
+                               throw new NullPointerException("column key is 
null");
+                       
+                   Integer columnIndex = columnKeyToIndex.get(columnKey);
+                   if (columnIndex == null)
+                       throw new IllegalArgumentException("column index does 
not exist: " + columnKey);
+                   
+                   return get(rowIndex, columnIndex);
+               }
+
+               @Override
+               public Node getRowKey() {
+                       return rowList.get(rowIndex);
+               }
+
+               @Override
+               public ExtendedIterator<Triple> getTripleIterator() {
+                       ArrayList<Triple> triples = new ArrayList<Triple>();
+                       for (int 
columnIndex=0;columnIndex<columnList.size();columnIndex++) {
+                               triples.add(Triple.create(getRowKey(), 
columnList.get(columnIndex), get(rowIndex, columnIndex)));
+                       }
+                       return WrappedIterator.create(triples.iterator());
+               }
+
+               @Override
+               public Collection<Column> getColumns() {
+                       return PropertyTableArrayImpl.this.getColumns();
+               }
+               
+       }
+
+
+
+
+}

Reply via email to