jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpz6311...@apache.org
Subject svn commit: r1519358 [1/5] - in /jena/trunk/jena-spatial: ./ src/ src/main/ src/main/java/ src/main/java/examples/ src/main/java/jena/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/jena/ src/main/java/org/apache/jena/query/ src/...
Date Mon, 02 Sep 2013 06:46:21 GMT
Author: jpz6311whu
Date: Mon Sep  2 06:46:19 2013
New Revision: 1519358

URL: http://svn.apache.org/r1519358
Log:
jena-spatial solr support

Added:
    jena/trunk/jena-spatial/DEPENDENCIES
    jena/trunk/jena-spatial/LICENSE
    jena/trunk/jena-spatial/NOTICE
    jena/trunk/jena-spatial/README.txt   (with props)
    jena/trunk/jena-spatial/ReleaseNotes.txt   (with props)
    jena/trunk/jena-spatial/log4j.properties   (with props)
    jena/trunk/jena-spatial/src/
    jena/trunk/jena-spatial/src/main/
    jena/trunk/jena-spatial/src/main/java/
    jena/trunk/jena-spatial/src/main/java/examples/
    jena/trunk/jena-spatial/src/main/java/examples/JenaSpatialExample1.java   (with props)
    jena/trunk/jena-spatial/src/main/java/jena/
    jena/trunk/jena-spatial/src/main/java/jena/spatialindexdump.java   (with props)
    jena/trunk/jena-spatial/src/main/java/jena/spatialindexer.java   (with props)
    jena/trunk/jena-spatial/src/main/java/log4j.properties   (with props)
    jena/trunk/jena-spatial/src/main/java/org/
    jena/trunk/jena-spatial/src/main/java/org/apache/
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/DatasetGraphSpatial.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/DistanceUnitsUtils.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/EntityDefinition.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDatasetFactory.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducer.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducerTriples.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndexContext.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndexException.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndexLucene.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndexSolr.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialPredicatePair.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialPredicatePairValue.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialQuery.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialValueUtil.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/assembler/
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/assembler/EntityDefinitionAssembler.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/assembler/SpatialAssembler.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/assembler/SpatialDatasetAssembler.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/assembler/SpatialIndexLuceneAssembler.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/assembler/SpatialIndexSolrAssembler.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/assembler/SpatialVocab.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/DirectionWithPointPFBase.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/SpatialMatch.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/SpatialOperationPFBase.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/SpatialOperationWithBoxPFBase.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/SpatialOperationWithCircleBase.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/EastPF.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IntersectsBoxPF.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsNearByPF.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsWithinBoxPF.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsWithinCirclePF.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/NorthPF.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/SouthPF.java   (with props)
    jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/WestPF.java   (with props)
    jena/trunk/jena-spatial/src/main/resources/
    jena/trunk/jena-spatial/src/main/resources/org/
    jena/trunk/jena-spatial/src/main/resources/org/apache/
    jena/trunk/jena-spatial/src/main/resources/org/apache/jena/
    jena/trunk/jena-spatial/src/main/resources/org/apache/jena/query/
    jena/trunk/jena-spatial/src/main/resources/org/apache/jena/query/spatial/
    jena/trunk/jena-spatial/src/main/resources/org/apache/jena/query/spatial/properties.xml   (with props)
    jena/trunk/jena-spatial/src/test/
    jena/trunk/jena-spatial/src/test/java/
    jena/trunk/jena-spatial/src/test/java/org/
    jena/trunk/jena-spatial/src/test/java/org/apache/
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/AbstractTestDatasetWithSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/SpatialSearchUtil.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TS_Spatial.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestIndexingSpatialDataWithLucene.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestSpatialPredicatePairValue.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestTDBDatasetWithLuceneSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/AbstractTestSpatialAssembler.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestEntityDefinitionAssembler.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialDatasetAssembler.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialIndexLuceneAssembler.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialIndexSolrAssembler.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestEastPF.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIntersectsBoxPF.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIsNearByPF.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIsWithinBoxPF.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIsWithinCirclePF.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestNorthPF.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestSouthPF.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestWestPF.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/lucene/
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/lucene/TestEastPFWithLuceneSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/lucene/TestIntersectsBoxPFWithLuceneSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/lucene/TestIsNearByPFWithLuceneSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/lucene/TestIsWithinBoxPFWithLuceneSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/lucene/TestIsWithinCirclePFWithLuceneSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/lucene/TestNorthPFWithLuceneSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/lucene/TestSouthPFWithLuceneSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/lucene/TestWestPFWithLuceneSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/solr/
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/solr/TestEastPFWithEmbeddedSolrSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/solr/TestIntersectsBoxPFWithEmbeddedSolrSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/solr/TestIsNearByPFWithEmbeddedSolrSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/solr/TestIsWithinBoxPFWithEmbeddedSolrSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/solr/TestIsWithinCirclePFWithEmbeddedSolrSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/solr/TestNorthPFWithEmbeddedSolrSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/solr/TestSouthPFWithEmbeddedSolrSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/solr/TestWestPFWithEmbeddedSolrSpatialIndex.java   (with props)
    jena/trunk/jena-spatial/src/test/resources/
    jena/trunk/jena-spatial/src/test/resources/SolrHome/
    jena/trunk/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/
    jena/trunk/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/conf/
    jena/trunk/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/conf/schema.xml   (with props)
    jena/trunk/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/conf/solrconfig.xml   (with props)
    jena/trunk/jena-spatial/src/test/resources/SolrHome/solr.xml   (with props)
    jena/trunk/jena-spatial/src/test/resources/geoarq-data-1.ttl
    jena/trunk/jena-spatial/src/test/resources/geoarq-query-1.rq
    jena/trunk/jena-spatial/src/test/resources/log4j.properties   (with props)
    jena/trunk/jena-spatial/src/test/resources/spatial-config-spatialindexer.ttl
    jena/trunk/jena-spatial/src/test/resources/spatial-config.ttl
    jena/trunk/jena-spatial/src/test/resources/spatial-solr-config.ttl
Modified:
    jena/trunk/jena-spatial/pom.xml

Added: jena/trunk/jena-spatial/DEPENDENCIES
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/DEPENDENCIES?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/DEPENDENCIES (added)
+++ jena/trunk/jena-spatial/DEPENDENCIES Mon Sep  2 06:46:19 2013
@@ -0,0 +1,25 @@
+This file lists the dependences for Apache Jena Spatial.
+  Version numbers are given in the POM file for a particular distribution. 
+
+Apache Projects:   Apache Software License
+  Apache Jena, including the Jena IRI library
+  Apache Xerces-J
+  Apache log4j
+  Apache HttpComponents (HTTP Client)
+  Apache Commons Codec
+  Apache Lucene
+
+SLF4J : http://www.slf4j.org/
+  Copyright (c) 2004-2008 QOS.ch
+  MIT License
+
+JUnit : http://junit.org/
+  Common Public License - v 1.0
+
+JTS Topology Suite : http://tsusiatsoftware.net/jts/main.html
+  LGPL Licence - v 2.1
+  
+spatial4j : https://github.com/spatial4j/spatial4j
+  Apache Software License - v 2.0
+
+ 
\ No newline at end of file

Added: jena/trunk/jena-spatial/LICENSE
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/LICENSE?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/LICENSE (added)
+++ jena/trunk/jena-spatial/LICENSE Mon Sep  2 06:46:19 2013
@@ -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.

Added: jena/trunk/jena-spatial/NOTICE
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/NOTICE?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/NOTICE (added)
+++ jena/trunk/jena-spatial/NOTICE Mon Sep  2 06:46:19 2013
@@ -0,0 +1,11 @@
+Apache Jena - ARQ module
+Copyright 2011-2013 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software were originally based on the following:
+  - Copyright 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
+  - Copyright 2010, 2011 Epimorphics Ltd.
+  - Copyright 2010 Talis Systems Ltd.
+These have been licensed to the Apache Software Foundation under a software grant.
\ No newline at end of file

Added: jena/trunk/jena-spatial/README.txt
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/README.txt?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/README.txt (added)
+++ jena/trunk/jena-spatial/README.txt Mon Sep  2 06:46:19 2013
@@ -0,0 +1,10 @@
+Jena Spatial : Simple Spatial Query with SPARQL.
+=====================
+
+It's an extension to Apache Jena ARQ, called jena-spatial, which combines SPARQL and simple spatial query. It gives applications the ability to perform simple spatial searches within SPARQL queries. Lucene spatial can be used for the spatial data indexing and searching.
+
+It's a GSoC 2013 project for Apache Jena : http://www.google-melange.com/gsoc/project/google/gsoc2013/jpz6311whu/13003
+
+Home page : http://code.google.com/p/jena-spatial/
+
+User document : http://code.google.com/p/jena-spatial/wiki/JenaSpatialUserDocument

Propchange: jena/trunk/jena-spatial/README.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/ReleaseNotes.txt
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/ReleaseNotes.txt?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/ReleaseNotes.txt (added)
+++ jena/trunk/jena-spatial/ReleaseNotes.txt Mon Sep  2 06:46:19 2013
@@ -0,0 +1,14 @@
+Release Notes 
+=============
+
+==== Jena Spatial 1.0.0
++ Jena spatial search support with property functions:
+  nearby
+  withinCircle
+  withinBox
+  intersectBox
+  north
+  south
+  west
+  east
+

Propchange: jena/trunk/jena-spatial/ReleaseNotes.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/log4j.properties
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/log4j.properties?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/log4j.properties (added)
+++ jena/trunk/jena-spatial/log4j.properties Mon Sep  2 06:46:19 2013
@@ -0,0 +1,15 @@
+log4j.rootLogger=WARN, stdlog
+
+log4j.appender.stdlog=org.apache.log4j.ConsoleAppender
+## log4j.appender.stdlog.target=System.err
+log4j.appender.stdlog.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdlog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-25c{1} :: %m%n
+
+# Execution logging
+log4j.logger.com.hp.hpl.jena.arq.info=INFO
+log4j.logger.com.hp.hpl.jena.arq.exec=INFO
+
+## Solr can be noisy.
+log4j.logger.org.apache.solr=WARN
+log4j.logger.org.apache.solr.core.CoreContainer=FATAL
+log4j.logger.org.apache.solr.core.JmxMonitoredMap=FATAL

Propchange: jena/trunk/jena-spatial/log4j.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jena/trunk/jena-spatial/pom.xml
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/pom.xml?rev=1519358&r1=1519357&r2=1519358&view=diff
==============================================================================
--- jena/trunk/jena-spatial/pom.xml (original)
+++ jena/trunk/jena-spatial/pom.xml Mon Sep  2 06:46:19 2013
@@ -7,7 +7,6 @@
   <name>Apache Jena - SPARQL and Lucene/Solr Spatial</name>
   <version>1.0.1-SNAPSHOT</version>
   
-  
   <parent>
     <groupId>org.apache.jena</groupId>
     <artifactId>jena-parent</artifactId>

Added: jena/trunk/jena-spatial/src/main/java/examples/JenaSpatialExample1.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/examples/JenaSpatialExample1.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/examples/JenaSpatialExample1.java (added)
+++ jena/trunk/jena-spatial/src/main/java/examples/JenaSpatialExample1.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,367 @@
+/*
+ * 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 examples;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.jena.atlas.lib.StrUtils;
+import org.apache.jena.atlas.logging.Log;
+import org.apache.jena.query.spatial.EntityDefinition;
+import org.apache.jena.query.spatial.SpatialDatasetFactory;
+import org.apache.jena.query.spatial.SpatialIndex;
+import org.apache.jena.query.spatial.SpatialIndexLucene;
+import org.apache.jena.query.spatial.SpatialIndexSolr;
+import org.apache.jena.query.spatial.SpatialQuery;
+import org.apache.jena.riot.RDFDataMgr;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.FSDirectory;
+import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.hp.hpl.jena.query.Dataset;
+import com.hp.hpl.jena.query.DatasetFactory;
+import com.hp.hpl.jena.query.Query;
+import com.hp.hpl.jena.query.QueryExecution;
+import com.hp.hpl.jena.query.QueryExecutionFactory;
+import com.hp.hpl.jena.query.QueryFactory;
+import com.hp.hpl.jena.query.ReadWrite;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ResourceFactory;
+import com.hp.hpl.jena.sparql.util.QueryExecUtils;
+import com.hp.hpl.jena.tdb.TDBFactory;
+
+/** Build a spatial search dataset */
+public class JenaSpatialExample1 {
+	static {
+		Log.setLog4j();
+	}
+	static Logger log = LoggerFactory.getLogger("JenaSpatialExample");
+	
+	private static final String LUCENE_INDEX_PATH = "target/test/TDBDatasetWithLuceneSpatialIndex";
+	private static final File LUCENE_INDEX_DIR = new File(LUCENE_INDEX_PATH);
+	private static final String LUCENE_TDB_PATH = "target/test/TDB";
+	private static final File LUCENE_TDB_DIR = new File(LUCENE_TDB_PATH);
+	
+    private static final String  SOLR_DATA_PATH      = "src/test/resources/SolrHome/SolrARQCollection/data";
+    private static final File    SOLR_DATA_DIR       = new File(SOLR_DATA_PATH);
+
+	public static void main(String... argv) throws IOException {
+		Dataset spatialDataset = initInMemoryDatasetWithLuceneSpatitalIndex(LUCENE_INDEX_DIR);
+		//Dataset spatialDataset = initTDBDatasetWithLuceneSpatitalIndex(indexDir, TDBDir);
+		//Dataset spatialDataset = createLuceneAssembler() ;
+		//Dataset spatialDataset = createSolrAssembler() ;
+		
+		loadData(spatialDataset, "src/test/resources/geoarq-data-1.ttl");
+		queryData(spatialDataset);
+		
+		destroy(spatialDataset);
+	}
+	
+	private static void destroy(Dataset spatialDataset){
+
+		SpatialIndex index = (SpatialIndex)spatialDataset.getContext().get(SpatialQuery.spatialIndex);
+		if (index instanceof SpatialIndexLucene){
+			deleteOldFiles(LUCENE_INDEX_DIR);
+			deleteOldFiles(LUCENE_TDB_DIR);
+		}
+		
+		else if (index instanceof SpatialIndexSolr){
+			SolrServer server = ((SpatialIndexSolr)index).getServer();
+			
+			if (server instanceof EmbeddedSolrServer){
+				server.shutdown();
+				deleteOldFiles(SOLR_DATA_DIR);
+			}
+		} 
+		
+	}
+    private static void emptyAndDeleteDirectory(File dir) {
+        File[] contents = dir.listFiles() ;
+        if (contents != null) {
+            for (File content : contents) {
+                if (content.isDirectory()) {
+                    emptyAndDeleteDirectory(content) ;
+                } else {
+                    content.delete() ;
+                }
+            }
+        }
+        dir.delete() ;
+    }
+    
+    private static Dataset initInMemoryDatasetWithLuceneSpatitalIndex(File indexDir) throws IOException{
+		SpatialQuery.init();
+		deleteOldFiles(indexDir);
+		indexDir.mkdirs();
+		return createDatasetByCode(indexDir);
+    }
+    
+    private static Dataset initTDBDatasetWithLuceneSpatitalIndex(File indexDir, File TDBDir) throws IOException{
+		SpatialQuery.init();
+		deleteOldFiles(indexDir);
+		deleteOldFiles(TDBDir);
+		indexDir.mkdirs();
+		TDBDir.mkdir();
+		return createDatasetByCode(indexDir, TDBDir);
+    }
+    
+	private static void deleteOldFiles(File indexDir) {
+		if (indexDir.exists())
+			emptyAndDeleteDirectory(indexDir);
+	}
+	
+	private static Dataset createDatasetByCode(File indexDir) throws IOException {
+		// Base data
+		Dataset ds1 = DatasetFactory.createMem();
+		return joinDataset(ds1, indexDir);
+	}
+	
+	private static Dataset createDatasetByCode(File indexDir, File TDBDir) throws IOException {
+		// Base data
+		Dataset ds1 = TDBFactory.createDataset(TDBDir.getAbsolutePath());
+		return joinDataset(ds1, indexDir);
+	}
+	
+	private static Dataset joinDataset(Dataset baseDataset, File indexDir) throws IOException{
+		EntityDefinition entDef = new EntityDefinition("entityField", "geoField");
+		entDef.addSpatialPredicatePair(ResourceFactory.createResource("http://localhost/jena_example/#latitude_1"), ResourceFactory.createResource("http://localhost/jena_example/#longitude_1"));
+		entDef.addSpatialPredicatePair(ResourceFactory.createResource("http://localhost/jena_example/#latitude_2"), ResourceFactory.createResource("http://localhost/jena_example/#longitude_2"));
+		entDef.addWKTPredicate(ResourceFactory.createResource("http://localhost/jena_example/#wkt_1"));
+		entDef.addWKTPredicate(ResourceFactory.createResource("http://localhost/jena_example/#wkt_2"));
+		
+
+		// Lucene, index in File system.
+		Directory dir = FSDirectory.open(indexDir);
+
+		// Join together into a dataset
+		Dataset ds = SpatialDatasetFactory.createLucene(baseDataset, dir, entDef);
+
+		return ds;
+	}
+
+	public static Dataset createLuceneAssembler() {
+		log.info("Construct lucene spatial dataset using an assembler description");
+
+		Dataset ds = DatasetFactory.assemble("src/test/resources/spatial-config.ttl",
+				"http://localhost/jena_example/#spatial_dataset");
+		
+
+		return ds;
+	}
+	
+	public static Dataset createSolrAssembler() {
+		log.info("Construct solr spatial dataset using an assembler description");
+		
+		Dataset ds = DatasetFactory.assemble("src/test/resources/spatial-solr-config.ttl",
+				"http://localhost/jena_example/#spatial_dataset");
+		return ds;
+	}
+
+	public static void loadData(Dataset spatialDataset, String file) {
+		log.info("Start loading");
+		long startTime = System.nanoTime();
+		spatialDataset.begin(ReadWrite.WRITE);
+		try {
+			Model m = spatialDataset.getDefaultModel();
+			RDFDataMgr.read(m, file);
+			// RDFDataMgr.read(dataset, "D.ttl") ;
+			spatialDataset.commit();
+		} finally {
+			spatialDataset.end();
+		}
+
+		long finishTime = System.nanoTime();
+		double time = (finishTime - startTime) / 1.0e6;
+		log.info(String.format("Finish loading - %.2fms", time));
+	}
+
+	public static void queryData(Dataset spatialDataset) {
+		log.info("START");
+		long startTime = System.nanoTime();
+		String pre = StrUtils.strjoinNL("PREFIX : <http://example/>",
+				"PREFIX spatial: <http://jena.apache.org/spatial#>",
+				"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>");
+
+		System.out.println("nearby");
+		String qs = StrUtils.strjoinNL("SELECT * ",
+				" { ?s spatial:nearby (51.3000 -2.71000 100.0 'miles') ;",
+				"      rdfs:label ?label", " }");
+
+		spatialDataset.begin(ReadWrite.READ);
+		try {
+			Query q = QueryFactory.create(pre + "\n" + qs);
+			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+			QueryExecUtils.executeQuery(q, qexec);
+		} finally {
+			spatialDataset.end();
+		}
+		long finishTime = System.nanoTime();
+		double time = (finishTime - startTime) / 1.0e6;
+		log.info(String.format("FINISH - %.2fms", time));
+
+		System.out.println("withinCircle");
+		startTime = System.nanoTime();
+		qs = StrUtils.strjoinNL("SELECT * ",
+				" { ?s spatial:withinCircle (51.3000 -2.71000 100.0 'miles' 3) ;",
+				"      rdfs:label ?label", " }");
+
+		spatialDataset.begin(ReadWrite.READ);
+		try {
+			Query q = QueryFactory.create(pre + "\n" + qs);
+			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+			QueryExecUtils.executeQuery(q, qexec);
+		} finally {
+			spatialDataset.end();
+		}
+		finishTime = System.nanoTime();
+		time = (finishTime - startTime) / 1.0e6;
+		log.info(String.format("FINISH - %.2fms", time));
+		
+		System.out.println("withinBox");
+		startTime = System.nanoTime();
+		qs = StrUtils.strjoinNL("SELECT * ",
+				" { ?s spatial:withinBox (51.1000 -4.0000 51.4000 0.0000 -1) ;",
+				"      rdfs:label ?label", " }");
+
+		spatialDataset.begin(ReadWrite.READ);
+		try {
+			Query q = QueryFactory.create(pre + "\n" + qs);
+			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+			QueryExecUtils.executeQuery(q, qexec);
+		} finally {
+			spatialDataset.end();
+		}
+		finishTime = System.nanoTime();
+		time = (finishTime - startTime) / 1.0e6;
+		log.info(String.format("FINISH - %.2fms", time));
+
+		System.out.println("interesectBox");
+		startTime = System.nanoTime();
+		qs = StrUtils.strjoinNL("SELECT * ",
+				" { ?s spatial:intersectBox (51.1000 -4.0000 51.4000 0.0000) ;",
+				"      rdfs:label ?label", " }");
+
+		spatialDataset.begin(ReadWrite.READ);
+		try {
+			Query q = QueryFactory.create(pre + "\n" + qs);
+			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+			QueryExecUtils.executeQuery(q, qexec);
+		} finally {
+			spatialDataset.end();
+		}
+		finishTime = System.nanoTime();
+		time = (finishTime - startTime) / 1.0e6;
+		log.info(String.format("FINISH - %.2fms", time));
+		
+		
+		System.out.println("north");
+		startTime = System.nanoTime();
+		qs = StrUtils.strjoinNL("SELECT * ",
+				" { ?s spatial:north (51.3000 0.0000) ;",
+				"      rdfs:label ?label", " }");
+
+		spatialDataset.begin(ReadWrite.READ);
+		try {
+			Query q = QueryFactory.create(pre + "\n" + qs);
+			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+			QueryExecUtils.executeQuery(q, qexec);
+		} finally {
+			spatialDataset.end();
+		}
+		finishTime = System.nanoTime();
+		time = (finishTime - startTime) / 1.0e6;
+		log.info(String.format("FINISH - %.2fms", time));
+		
+		System.out.println("south");
+		startTime = System.nanoTime();
+		qs = StrUtils.strjoinNL("SELECT * ",
+				" { ?s spatial:south (51.3000 0.0000) ;",
+				"      rdfs:label ?label", " }");
+
+		spatialDataset.begin(ReadWrite.READ);
+		try {
+			Query q = QueryFactory.create(pre + "\n" + qs);
+			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+			QueryExecUtils.executeQuery(q, qexec);
+		} finally {
+			spatialDataset.end();
+		}
+		finishTime = System.nanoTime();
+		time = (finishTime - startTime) / 1.0e6;
+		log.info(String.format("FINISH - %.2fms", time));
+		
+		System.out.println("east");
+		startTime = System.nanoTime();
+		qs = StrUtils.strjoinNL("SELECT * ",
+				" { ?s spatial:east (51.3000 0.0000) ;",
+				"      rdfs:label ?label", " }");
+
+		spatialDataset.begin(ReadWrite.READ);
+		try {
+			Query q = QueryFactory.create(pre + "\n" + qs);
+			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+			QueryExecUtils.executeQuery(q, qexec);
+		} finally {
+			spatialDataset.end();
+		}
+		finishTime = System.nanoTime();
+		time = (finishTime - startTime) / 1.0e6;
+		log.info(String.format("FINISH - %.2fms", time));
+		
+		System.out.println("west");
+		startTime = System.nanoTime();
+		qs = StrUtils.strjoinNL("SELECT * ",
+				" { ?s spatial:west (51.3000 0.0000) ;",
+				"      rdfs:label ?label", " }");
+
+		spatialDataset.begin(ReadWrite.READ);
+		try {
+			Query q = QueryFactory.create(pre + "\n" + qs);
+			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+			QueryExecUtils.executeQuery(q, qexec);
+		} finally {
+			spatialDataset.end();
+		}
+		finishTime = System.nanoTime();
+		time = (finishTime - startTime) / 1.0e6;
+		log.info(String.format("FINISH - %.2fms", time));
+		
+		System.out.println("west2");
+		startTime = System.nanoTime();
+		qs = StrUtils.strjoinNL("SELECT * ",
+				" { ?s spatial:withinBox (51.1 -180.0000 51.9 0.0000) ;",
+				"      rdfs:label ?label", " }");
+
+		spatialDataset.begin(ReadWrite.READ);
+		try {
+			Query q = QueryFactory.create(pre + "\n" + qs);
+			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+			QueryExecUtils.executeQuery(q, qexec);
+		} finally {
+			spatialDataset.end();
+		}
+		finishTime = System.nanoTime();
+		time = (finishTime - startTime) / 1.0e6;
+		log.info(String.format("FINISH - %.2fms", time));
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/main/java/examples/JenaSpatialExample1.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/jena/spatialindexdump.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/jena/spatialindexdump.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/jena/spatialindexdump.java (added)
+++ jena/trunk/jena-spatial/src/main/java/jena/spatialindexdump.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,127 @@
+/*
+ * 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 jena ;
+
+import org.apache.jena.query.spatial.SpatialIndex;
+import org.apache.jena.query.spatial.SpatialIndexException;
+import org.apache.jena.query.spatial.SpatialIndexLucene;
+import org.apache.jena.query.spatial.SpatialQuery;
+import org.apache.jena.query.spatial.assembler.SpatialVocab;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.index.DirectoryReader;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.IndexableField;
+import org.apache.lucene.queryparser.classic.QueryParser;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.ScoreDoc;
+import org.apache.lucene.store.Directory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import arq.cmd.CmdException;
+import arq.cmdline.ArgDecl;
+import arq.cmdline.CmdARQ;
+
+import com.hp.hpl.jena.sparql.core.assembler.AssemblerUtils;
+import com.hp.hpl.jena.sparql.util.Utils;
+
+/**
+ * Text index development tool - dump the index.
+ */
+public class spatialindexdump extends CmdARQ {
+
+    private static Logger      log          = LoggerFactory.getLogger(spatialindexdump.class) ;
+
+    public static final ArgDecl assemblerDescDecl = new ArgDecl(ArgDecl.HasValue, "desc", "dataset") ;
+    protected SpatialIndex        spatialIndex    = null ;
+
+    static public void main(String... argv) {
+        SpatialQuery.init() ;
+        new spatialindexdump(argv).mainRun() ;
+    }
+
+    protected spatialindexdump(String[] argv) {
+        super(argv) ;
+        super.add(assemblerDescDecl, "--desc=", "Assembler description file") ;
+    }
+
+    @Override
+    protected void processModulesAndArgs() {
+        super.processModulesAndArgs() ;
+        // Two forms : with and without arg.
+        // Maximises similarity with other tools.
+        String file ;
+        if ( super.contains(assemblerDescDecl) ) {
+            if ( getValues(assemblerDescDecl).size() != 1 )
+                throw new CmdException("Multiple assembler descriptions given") ;
+            if ( getPositional().size() != 0 )
+                throw new CmdException("Additional assembler descriptions given") ; 
+            file = getValue(assemblerDescDecl) ;
+        } else {
+            if ( getNumPositional() != 1 )
+                throw new CmdException("Multiple assembler descriptions given") ;
+            file = getPositionalArg(0) ;
+        }
+        spatialIndex = (SpatialIndex)AssemblerUtils.build(file, SpatialVocab.spatialIndex) ;
+    }        
+
+    @Override
+    protected String getSummary() {
+        return getCommandName() + " assemblerFile" ;
+    }
+
+    @Override
+    protected void exec() {
+        
+        if ( spatialIndex instanceof SpatialIndexLucene )
+            dump((SpatialIndexLucene)spatialIndex) ;
+//        else if ( spatialIndex instanceof SpatialIndexSolr )
+//            dump((SpatialIndexSolr)spatialIndex) ;
+        else
+            System.err.println("Unsupported index type : "+Utils.className(spatialIndex)) ;
+        }
+
+//    private static void dump(SpatialIndexSolr spatialIndex) { System.err.println("Not implemented : dump Solr index") ; }
+
+    private static void dump(SpatialIndexLucene spatialIndex) {
+        try {
+            Directory directory = spatialIndex.getDirectory() ;
+            Analyzer analyzer = spatialIndex.getAnalyzer() ;
+            IndexReader indexReader = DirectoryReader.open(directory) ;
+            IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+            QueryParser queryParser = new QueryParser(SpatialIndexLucene.VER, spatialIndex.getDocDef().getEntityField(), analyzer);
+            Query query = queryParser.parse("*:*");
+            ScoreDoc[] sDocs = indexSearcher.search(query, 1000).scoreDocs ;
+            for ( ScoreDoc sd : sDocs ) {
+                System.out.println("Doc: "+sd.doc) ;
+                Document doc = indexSearcher.doc(sd.doc) ;
+                //System.out.println(doc) ;
+                for ( IndexableField f : doc ) {
+                    //System.out.println("  "+f) ;
+                    System.out.println("  "+f.name()+" = "+f.stringValue()) ;
+                }
+                
+            }
+
+        } catch (Exception ex) { throw new SpatialIndexException(ex) ; }
+        
+    }
+}

Propchange: jena/trunk/jena-spatial/src/main/java/jena/spatialindexdump.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/jena/spatialindexer.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/jena/spatialindexer.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/jena/spatialindexer.java (added)
+++ jena/trunk/jena-spatial/src/main/java/jena/spatialindexer.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,190 @@
+/*
+ * 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 jena;
+
+import java.util.Iterator;
+
+import org.apache.jena.query.spatial.DatasetGraphSpatial;
+import org.apache.jena.query.spatial.SpatialDatasetFactory;
+import org.apache.jena.query.spatial.SpatialIndex;
+import org.apache.jena.query.spatial.SpatialIndexContext;
+import org.apache.jena.query.spatial.SpatialQuery;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import arq.cmd.CmdException;
+import arq.cmdline.ArgDecl;
+import arq.cmdline.CmdARQ;
+
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.query.Dataset;
+import com.hp.hpl.jena.sparql.core.Quad;
+
+/**
+ * Spatial indexer application that will read a dataset and index its triples in
+ * its spatial index.
+ */
+public class spatialindexer extends CmdARQ {
+
+	private static Logger log = LoggerFactory.getLogger(spatialindexer.class);
+
+	public static final ArgDecl assemblerDescDecl = new ArgDecl(
+			ArgDecl.HasValue, "desc", "dataset");
+
+	protected DatasetGraphSpatial dataset = null;
+	protected SpatialIndex spatialIndex = null;
+	protected SpatialIndexContext context = null; 
+	protected ProgressMonitor progressMonitor;
+		
+	static public void main(String... argv) {
+		SpatialQuery.init();
+		new spatialindexer(argv).mainRun();
+	}
+
+	static public void testMain(String... argv) {
+		new spatialindexer(argv).mainMethod();
+	}
+
+	protected spatialindexer(String[] argv) {
+		super(argv);
+		super.add(assemblerDescDecl, "--desc=", "Assembler description file");
+		progressMonitor = new ProgressMonitor("properties indexed");
+	}
+
+	@Override
+	protected void processModulesAndArgs() {
+		super.processModulesAndArgs();
+		// Two forms : with and without arg.
+		// Maximises similarity with other tools.
+		String file;
+		if (super.contains(assemblerDescDecl)) {
+			if (getValues(assemblerDescDecl).size() != 1)
+				throw new CmdException("Multiple assembler descriptions given");
+			if (getPositional().size() != 0)
+				throw new CmdException(
+						"Additional assembler descriptions given");
+			file = getValue(assemblerDescDecl);
+		} else {
+			if (getNumPositional() != 1)
+				throw new CmdException("Multiple assembler descriptions given");
+			file = getPositionalArg(0);
+		}
+
+		if (file == null)
+			throw new CmdException("No dataset specified");
+		// Assumes a single test daatset description in the assembler file.
+		Dataset ds = SpatialDatasetFactory.create(file);
+		if (ds == null)
+			throw new CmdException("No dataset description found");
+		// get index.
+		dataset = (DatasetGraphSpatial) (ds.asDatasetGraph());
+		spatialIndex = dataset.getSpatialIndex();
+		if (spatialIndex == null)
+			throw new CmdException("Dataset has no text index");
+		
+		context= new SpatialIndexContext(spatialIndex);
+	}
+
+	@Override
+	protected String getSummary() {
+		return getCommandName() + " assemblerFile";
+	}
+
+	@Override
+	protected void exec() {
+		// Set<Node> properties = getIndexedProperties() ;
+		spatialIndex.startIndexing();
+
+		Iterator<Quad> quadIter = dataset.find(Node.ANY, Node.ANY, Node.ANY,
+				Node.ANY);
+		for (; quadIter.hasNext();) {
+			Quad quad = quadIter.next();
+			context.index(quad.getGraph(), quad.getSubject(), quad.getPredicate(),
+					quad.getObject());
+			progressMonitor.progressByOne();
+
+		}
+		spatialIndex.finishIndexing();
+		progressMonitor.close();
+	}
+
+	// TDBLoader has a similar progress monitor
+	// Not used here to avoid making ARQ dependent on TDB
+	// So potential to rationalise and put progress monitor in a common
+	// utility class
+	private static class ProgressMonitor {
+		String progressMessage;
+		long startTime;
+		long progressCount;
+		long intervalStartTime;
+		long progressAtStartOfInterval;
+		long reportingInterval = 10000; // milliseconds
+
+		ProgressMonitor(String progressMessage) {
+			this.progressMessage = progressMessage;
+			start(); // in case start not called
+		}
+
+		void start() {
+			startTime = System.currentTimeMillis();
+			progressCount = 0L;
+			startInterval();
+		}
+
+		private void startInterval() {
+			intervalStartTime = System.currentTimeMillis();
+			progressAtStartOfInterval = progressCount;
+		}
+
+		void progressByOne() {
+			progressCount++;
+			long now = System.currentTimeMillis();
+			if (reportDue(now)) {
+				report(now);
+				startInterval();
+			}
+		}
+
+		boolean reportDue(long now) {
+			return now - intervalStartTime >= reportingInterval;
+		}
+
+		private void report(long now) {
+			long progressThisInterval = progressCount
+					- progressAtStartOfInterval;
+			long intervalDuration = now - intervalStartTime;
+			long overallDuration = now - startTime;
+			String message = progressCount + " (" + progressThisInterval
+					/ (intervalDuration / 1000) + " per second)"
+					+ progressMessage + " (" + progressCount
+					/ Math.max(overallDuration / 1000, 1)
+					+ " per second overall)";
+			log.info(message);
+		}
+
+		void close() {
+			long overallDuration = System.currentTimeMillis() - startTime;
+			String message = progressCount + " (" + progressCount
+					/ Math.max(overallDuration / 1000, 1) + " per second) "
+					+ progressMessage;
+			log.info(message);
+		}
+	}
+	
+}

Propchange: jena/trunk/jena-spatial/src/main/java/jena/spatialindexer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/log4j.properties
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/log4j.properties?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/log4j.properties (added)
+++ jena/trunk/jena-spatial/src/main/java/log4j.properties Mon Sep  2 06:46:19 2013
@@ -0,0 +1,15 @@
+log4j.rootLogger=INFO, stdlog
+
+log4j.appender.stdlog=org.apache.log4j.ConsoleAppender
+## log4j.appender.stdlog.target=System.err
+log4j.appender.stdlog.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdlog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-25c{1} :: %m%n
+
+# Execution logging
+log4j.logger.com.hp.hpl.jena.arq.info=INFO
+log4j.logger.com.hp.hpl.jena.arq.exec=INFO
+
+## Solr can be noisy.
+log4j.logger.org.apache.solr=WARN
+log4j.logger.org.apache.solr.core.CoreContainer=FATAL
+log4j.logger.org.apache.solr.core.JmxMonitoredMap=FATAL

Propchange: jena/trunk/jena-spatial/src/main/java/log4j.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/DatasetGraphSpatial.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/DatasetGraphSpatial.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/DatasetGraphSpatial.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/DatasetGraphSpatial.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,128 @@
+/*
+ * 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.query.spatial;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.query.ReadWrite;
+import com.hp.hpl.jena.sparql.core.DatasetGraph;
+import com.hp.hpl.jena.sparql.core.DatasetGraphMonitor;
+import com.hp.hpl.jena.sparql.core.DatasetGraphWithLock;
+import com.hp.hpl.jena.sparql.core.GraphView;
+import com.hp.hpl.jena.sparql.core.Transactional;
+
+public class DatasetGraphSpatial extends DatasetGraphMonitor implements Transactional 
+{
+    private static Logger log = LoggerFactory.getLogger(DatasetGraphSpatial.class) ;
+    private final SpatialIndex spatialIndex ;
+    private final Transactional dsgtxn ;
+
+    public DatasetGraphSpatial(DatasetGraph dsg, SpatialIndex index, SpatialDocProducer producer)
+    {
+        super(dsg, producer) ;
+        this.spatialIndex = index ;
+        if ( dsg instanceof Transactional )
+            dsgtxn = (Transactional)dsg ;
+        else
+            dsgtxn = new DatasetGraphWithLock(dsg) ;
+    }
+
+//    public DatasetGraph getBase() { return getWrapped() ; }
+    
+    // ---- Intecept these and force the use of views.
+    @Override
+    public Graph getDefaultGraph()
+    { return GraphView.createDefaultGraph(this) ; }
+
+    @Override
+    public Graph getGraph(Node graphNode)
+    { return GraphView.createNamedGraph(this, graphNode) ; }
+    // ----    
+    
+    public SpatialIndex getSpatialIndex()
+    {
+        return spatialIndex;
+    }
+
+    // Imperfect.
+    private boolean needFinish = false ;
+    
+    @Override
+    public void begin(ReadWrite readWrite)
+    {
+        dsgtxn.begin(readWrite) ;
+        //textIndex.begin(readWrite) ;
+        if ( readWrite == ReadWrite.WRITE )
+        {
+            // WRONG design
+            super.getMonitor().start() ;
+            // Right design.
+            //textIndex.startIndexing() ;
+            needFinish = true ;
+        }
+    }
+
+    @Override
+    public void commit()
+    {
+        try {
+            if ( needFinish )
+            {
+                super.getMonitor().finish() ;
+                //spatialIndex.finishIndexing() ;
+            }
+            needFinish = false ;
+            //spatialIndex.commit() ;
+            dsgtxn.commit() ;
+        } catch (Throwable ex) { 
+            log.warn("Exception in commit: "+ex.getMessage(), ex) ;
+            dsgtxn.abort() ; 
+        }
+    }
+
+    @Override
+    public void abort()
+    {
+        try {
+            if ( needFinish )
+                spatialIndex.abortIndexing() ;
+            //spatialIndex.abort() ;
+            dsgtxn.abort() ;
+        } catch (Throwable ex) { log.warn("Exception in abort: "+ex.getMessage(), ex) ; }
+    }
+
+    @Override
+    public boolean isInTransaction()
+    {
+        return dsgtxn.isInTransaction() ;
+    }
+
+    @Override
+    public void end()
+    {
+        try {
+            //spatialIndex.end() ;
+            dsgtxn.end() ;
+        } catch (Throwable ex) { log.warn("Exception in end: "+ex.getMessage(), ex) ; }
+    }
+}
+

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/DatasetGraphSpatial.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/DistanceUnitsUtils.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/DistanceUnitsUtils.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/DistanceUnitsUtils.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/DistanceUnitsUtils.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,78 @@
+/*
+ * 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.query.spatial;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.spatial4j.core.distance.DistanceUtils;
+
+public class DistanceUnitsUtils {
+
+	public final static List<String> SUPPORTED_UNITS;
+	static {
+		SUPPORTED_UNITS = new ArrayList<String>();
+		SUPPORTED_UNITS.add("kilometers");
+		SUPPORTED_UNITS.add("km");
+		SUPPORTED_UNITS.add("meters");
+		SUPPORTED_UNITS.add("m");
+		SUPPORTED_UNITS.add("centimeters");
+		SUPPORTED_UNITS.add("cm");
+		SUPPORTED_UNITS.add("milimeters");
+		SUPPORTED_UNITS.add("mm");
+		SUPPORTED_UNITS.add("miles");
+		SUPPORTED_UNITS.add("mi");
+		SUPPORTED_UNITS.add("degrees");
+		SUPPORTED_UNITS.add("de");
+	}
+
+	public static double dist2Degrees(double dist, String units) {
+		double degrees = dist;
+
+		if (units.equals("kilometers") || units.equals("km"))
+			return DistanceUtils.dist2Degrees(dist,
+					DistanceUtils.EARTH_MEAN_RADIUS_KM);
+
+		else if (units.equals("meters") || units.equals("m"))
+			return DistanceUtils.dist2Degrees(dist / 1000,
+					DistanceUtils.EARTH_MEAN_RADIUS_KM);
+
+		else if (units.equals("centimeters") || units.equals("cm"))
+			return DistanceUtils.dist2Degrees(dist / (1000 * 100),
+					DistanceUtils.EARTH_MEAN_RADIUS_KM) ;
+
+		else if (units.equals("milimeters") || units.equals("mm"))
+			return DistanceUtils.dist2Degrees(dist / (1000 * 1000),
+					DistanceUtils.EARTH_MEAN_RADIUS_KM) ;
+
+		else if (units.equals("miles") || units.equals("mi"))
+			return DistanceUtils.dist2Degrees(dist,
+					DistanceUtils.EARTH_MEAN_RADIUS_MI);
+
+		else if (units.equals("degrees") || units.equals("de"))
+			return degrees;
+
+		throw new IllegalArgumentException("unknow distance units: "+ units);
+	}
+	
+	public static boolean isSupportedUnits(String units){
+		return SUPPORTED_UNITS.contains(units);
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/DistanceUnitsUtils.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/EntityDefinition.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/EntityDefinition.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/EntityDefinition.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/EntityDefinition.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,167 @@
+/*
+ * 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.query.spatial;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.rdf.model.Property;
+import com.hp.hpl.jena.rdf.model.Resource;
+import com.hp.hpl.jena.rdf.model.ResourceFactory;
+
+/**
+ * Definition of a "document"
+ */
+public class EntityDefinition {
+
+	private final String entityField;
+	private final String geoField;
+	private final Set<Node> WKTPredicates;
+	private final Set<Node> builtinWKTPredicates;
+	private final Set<SpatialPredicatePair> spatialPredicatePairs;
+	private final Set<SpatialPredicatePair> builtinSpatialPredicatePairs;
+
+	private final static String geo_ns = "http://www.w3.org/2003/01/geo/wgs84_pos#";
+	public final static Property geo_latitude = ResourceFactory
+			.createProperty(geo_ns + "lat");
+	public final static Property geo_longitude = ResourceFactory
+			.createProperty(geo_ns + "long");
+	public final static Property geo_geometry = ResourceFactory
+			.createProperty(geo_ns + "geometry");
+
+	public final static Property geosparql_asWKT = ResourceFactory
+			.createProperty("http://www.opengis.net/ont/geosparql#asWKT");
+
+	public final static Resource geosparql_wktLiteral = ResourceFactory
+			.createResource("http://www.opengis.net/ont/geosparql#wktLiteral");
+
+	/**
+	 * @param entityField
+	 *            The entity being indexed (e.g. it's URI).
+	 */
+	public EntityDefinition(String entityField, String geoField) {
+		this.entityField = entityField==null || entityField.isEmpty() ? "entityField":entityField;
+		this.geoField = geoField==null || geoField.isEmpty() ? "geoField":geoField;
+		this.WKTPredicates = new HashSet<Node>();
+		this.builtinWKTPredicates = new HashSet<Node>();
+		this.spatialPredicatePairs = new HashSet<SpatialPredicatePair>();
+		this.builtinSpatialPredicatePairs = new HashSet<SpatialPredicatePair>();
+		initBuiltinPredicates();
+	}
+
+	private void initBuiltinPredicates() {
+		addBuiltinWKTPredicate(geo_geometry);
+		addBuiltinWKTPredicate(geosparql_asWKT);
+		addBuiltinSpatialPredicatePair(geo_latitude, geo_longitude);
+	}
+	
+	private boolean addBuiltinWKTPredicate(Resource predicate) {
+		builtinWKTPredicates.add(predicate.asNode());
+		return addWKTPredicate(predicate);
+	}
+
+	public boolean addWKTPredicate(Resource predicate) {
+		return WKTPredicates.add(predicate.asNode());
+	}
+
+	private boolean addBuiltinSpatialPredicatePair(Resource latitude_predicate,
+			Resource longitude_predicate) {
+		builtinSpatialPredicatePairs.add(new SpatialPredicatePair(
+				latitude_predicate.asNode(), longitude_predicate.asNode()));
+		return addSpatialPredicatePair(latitude_predicate, longitude_predicate);
+	}
+	
+	public boolean addSpatialPredicatePair(Resource latitude_predicate,
+			Resource longitude_predicate) {
+		return spatialPredicatePairs.add(new SpatialPredicatePair(
+				latitude_predicate.asNode(), longitude_predicate.asNode()));
+	}
+	
+
+	public String getEntityField() {
+		return entityField;
+	}
+
+	public String getGeoField() {
+		return geoField;
+	}
+
+	public boolean isWKTPredicate(Node predicate) {
+		return this.WKTPredicates.contains(predicate);
+	}
+
+	public boolean isSpatialPredicate(Node predicate) {
+		return this.getSpatialPredicatePair(predicate) != null;
+	}
+
+	public boolean isLatitudePredicate(Node predicate) {
+		return this.getSpatialPredicatePair(predicate).getLatitudePredicate()
+				.equals(predicate);
+	}
+
+	public SpatialPredicatePair getSpatialPredicatePair(Node predicate) {
+		Iterator<SpatialPredicatePair> it = this.spatialPredicatePairs
+				.iterator();
+		while (it.hasNext()) {
+			SpatialPredicatePair pair = it.next();
+			if (pair.getLatitudePredicate().equals(predicate)
+					|| pair.getLongitudePredicate().equals(predicate)) {
+				return pair;
+			}
+		}
+		return null;
+	}
+	
+	public int getCustomSpatialPredicatePairCount(){
+		return this.spatialPredicatePairs.size()-builtinSpatialPredicatePairs.size();
+	}
+	
+	public int getSpatialPredicatePairCount(){
+		return this.spatialPredicatePairs.size();
+	}
+	
+	public int getCustomWKTPredicateCount(){
+		return this.WKTPredicates.size()- builtinWKTPredicates.size();
+	}
+	
+	public int getWKTPredicateCount(){
+		return this.WKTPredicates.size();
+	}
+	
+	public boolean hasSpatialPredicatePair(Node latitude_predicate, Node longitude_predicate){
+		Iterator<SpatialPredicatePair> it = this.spatialPredicatePairs
+				.iterator();
+		while (it.hasNext()) {
+			SpatialPredicatePair pair = it.next();
+			if (pair.getLatitudePredicate().equals(latitude_predicate)
+					&& pair.getLongitudePredicate().equals(longitude_predicate)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	@Override
+	public String toString() {
+		return entityField + ":" + geoField;
+
+	}
+}

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/EntityDefinition.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDatasetFactory.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDatasetFactory.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDatasetFactory.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDatasetFactory.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.query.spatial;
+
+import org.apache.jena.query.spatial.assembler.SpatialVocab;
+import org.apache.lucene.store.Directory;
+import org.apache.solr.client.solrj.SolrServer;
+
+import com.hp.hpl.jena.query.Dataset;
+import com.hp.hpl.jena.query.DatasetFactory;
+import com.hp.hpl.jena.sparql.core.DatasetGraph;
+import com.hp.hpl.jena.sparql.core.assembler.AssemblerUtils;
+import com.hp.hpl.jena.sparql.util.Context;
+
+public class SpatialDatasetFactory
+{
+    static { SpatialQuery.init(); }
+    
+    /** Use an assembler file to build a dataset with spatial search capabilities */ 
+    public static Dataset create(String assemblerFile)
+    {
+        return (Dataset)AssemblerUtils.build(assemblerFile, SpatialVocab.spatialDataset) ;
+    }
+
+    /** Create a text-indexed dataset */ 
+    public static Dataset create(Dataset base, SpatialIndex textIndex)
+    {
+        DatasetGraph dsg = base.asDatasetGraph() ;
+        dsg = create(dsg, textIndex) ;
+        return DatasetFactory.create(dsg) ;
+    }
+
+
+    /** Create a text-indexed dataset */ 
+    public static DatasetGraph create(DatasetGraph dsg, SpatialIndex spatialIndex)
+    {
+        SpatialDocProducer producer = new SpatialDocProducerTriples(spatialIndex) ;
+        DatasetGraph dsgt = new DatasetGraphSpatial(dsg, spatialIndex, producer) ;
+        // Also set on dsg
+        Context c = dsgt.getContext() ;
+        
+        dsgt.getContext().set(SpatialQuery.spatialIndex, spatialIndex) ;
+        return dsgt ;
+
+    }
+    
+    /** Create a Lucene TextIndex */ 
+    public static SpatialIndex createLuceneIndex(Directory directory, EntityDefinition entMap)
+    {
+        SpatialIndex index = new SpatialIndexLucene(directory, entMap) ;
+        return index ; 
+    }
+
+    /** Create a text-indexed dataset, using Lucene */ 
+    public static Dataset createLucene(Dataset base, Directory directory, EntityDefinition entMap)
+    {
+        SpatialIndex index = createLuceneIndex(directory, entMap) ;
+        return create(base, index) ; 
+    }
+
+    /** Create a text-indexed dataset, using Lucene */ 
+    public static DatasetGraph createLucene(DatasetGraph base, Directory directory, EntityDefinition entMap)
+    {
+        SpatialIndex index = createLuceneIndex(directory, entMap) ;
+        return create(base, index) ; 
+    }
+
+    /** Create a Solr TextIndex */ 
+    public static SpatialIndex createSolrIndex(SolrServer server, EntityDefinition entMap)
+    {
+        SpatialIndex index = new SpatialIndexSolr(server, entMap) ;
+        return index ; 
+    }
+
+    /** Create a text-indexed dataset, using Solr */ 
+    public static Dataset createSolrIndex(Dataset base, SolrServer server, EntityDefinition entMap)
+    {
+        SpatialIndex index = createSolrIndex(server, entMap) ;
+        return create(base, index) ; 
+    }
+
+    /** Create a text-indexed dataset, using Solr */ 
+    public static DatasetGraph createSolrIndex(DatasetGraph base, SolrServer server, EntityDefinition entMap)
+    {
+        SpatialIndex index = createSolrIndex(server, entMap) ;
+        return create(base, index) ; 
+    }
+}
+

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDatasetFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducer.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducer.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducer.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducer.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,27 @@
+/*
+ * 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.query.spatial;
+
+import com.hp.hpl.jena.sparql.core.DatasetChanges ;
+
+public interface SpatialDocProducer extends DatasetChanges
+{
+
+}
+

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducerTriples.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducerTriples.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducerTriples.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducerTriples.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.query.spatial;
+
+import java.util.List;
+
+import org.apache.jena.atlas.iterator.Iter;
+import org.apache.jena.atlas.iterator.Transform;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.sparql.core.Quad;
+import com.hp.hpl.jena.sparql.core.QuadAction;
+
+public class SpatialDocProducerTriples implements SpatialDocProducer {
+	private static Logger log = LoggerFactory
+			.getLogger(SpatialDocProducerTriples.class);
+//	private final EntityDefinition defn;
+	private final SpatialIndex indexer;
+	private boolean started = false;
+	
+	private SpatialIndexContext context = null; 
+
+	public SpatialDocProducerTriples(SpatialIndex indexer) {
+		this.indexer = indexer;
+		this.context = new SpatialIndexContext(indexer);
+	}
+
+	@Override
+	public void start() {
+		indexer.startIndexing();
+		started = true;
+	}
+
+	@Override
+	public void finish() {
+		indexer.finishIndexing();
+	}
+
+	@Override
+	public void change(QuadAction qaction, Node g, Node s, Node p, Node o) {
+		// One document per triple/quad
+
+		if (qaction != QuadAction.ADD)
+			return;
+		context.index(g, s, p, o);
+	}
+
+	static Transform<Quad, Triple> QuadsToTriples = new Transform<Quad, Triple>() {
+		@Override
+		public Triple convert(Quad item) {
+			return item.asTriple();
+		}
+
+	};
+
+	static private List<Triple> quadsToTriples(List<Quad> quads) {
+		return Iter.map(quads, QuadsToTriples);
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducerTriples.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndex.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndex.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndex.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndex.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.query.spatial ;
+
+import java.util.List;
+
+import org.apache.jena.atlas.lib.Closeable;
+import org.apache.lucene.spatial.query.SpatialOperation;
+
+import com.hp.hpl.jena.graph.Node;
+import com.spatial4j.core.shape.Shape;
+
+/** SpatialIndex abstraction */ 
+public interface SpatialIndex extends Closeable //, Transactional 
+{
+    // Update operations
+    public abstract void startIndexing() ;
+    public abstract void add(String EntityURI, Shape... shapes) ;
+    public abstract void finishIndexing() ;
+    public abstract void abortIndexing() ;
+    
+    /** Access the index - limit if -1 for as many as possible */    
+    public abstract List<Node> query(Shape shape, int limit, SpatialOperation operation);
+
+    public abstract EntityDefinition getDocDef() ;
+}

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndex.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndexContext.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndexContext.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndexContext.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndexContext.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,102 @@
+/*
+ * 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.query.spatial;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import com.hp.hpl.jena.graph.Node;
+import com.spatial4j.core.shape.Shape;
+
+public class SpatialIndexContext {
+
+	private final EntityDefinition defn;
+	private final SpatialIndex indexer;
+	private final Map<String, Set<SpatialPredicatePairValue>> spatialPredicatePairValues;
+
+	public SpatialIndexContext(SpatialIndex indexer) {
+		super();
+		this.defn = indexer.getDocDef();
+		this.indexer = indexer;
+		this.spatialPredicatePairValues = new HashMap<String, Set<SpatialPredicatePairValue>>();
+		;
+	}
+
+	public void index(Node g, Node s, Node p, Node o) {
+
+		if (!o.isLiteral()) {
+			return;
+		}
+
+		String x = (s.isURI()) ? s.getURI() : s.getBlankNodeLabel();
+
+		if (defn.isSpatialPredicate(p) && SpatialValueUtil.isDecimal(o.getLiteral())) {
+
+			boolean isLat = defn.isLatitudePredicate(p);
+
+			SpatialPredicatePair pair = defn.getSpatialPredicatePair(p);
+			Set<SpatialPredicatePairValue> pairValues = spatialPredicatePairValues
+					.get(x);
+			if (pairValues == null) {
+				pairValues = new HashSet<SpatialPredicatePairValue>();
+				spatialPredicatePairValues.put(x, pairValues);
+			}
+
+			Iterator<SpatialPredicatePairValue> it = pairValues.iterator();
+			SpatialPredicatePairValue toRemove = null;
+
+			while (it.hasNext()) {
+				SpatialPredicatePairValue pairValue = it.next();
+				if (pairValue.getPair().equals(pair)) {
+					Double theOtherValue = pairValue.getTheOtherValue(p);
+					if (theOtherValue != null) {
+						if (isLat) {
+							indexer.add(x, SpatialQuery.ctx.makePoint(
+									theOtherValue, Double.parseDouble(o
+											.getLiteralLexicalForm())));
+						} else {
+							indexer.add(x, SpatialQuery.ctx.makePoint(Double
+									.parseDouble(o.getLiteralLexicalForm()),
+									theOtherValue));
+						}
+						toRemove = pairValue;
+					}
+					break;
+				}
+			}
+			if (toRemove != null) {
+				pairValues.remove(toRemove);
+				return;
+			}
+
+			SpatialPredicatePairValue toAdd = new SpatialPredicatePairValue(
+					pair);
+			toAdd.setValue(p, Double.parseDouble(o.getLiteralLexicalForm()));
+			pairValues.add(toAdd);
+
+		} else if (defn.isWKTPredicate(p) && SpatialValueUtil.isWKTLiteral(o.getLiteral())) {
+
+			Shape shape = SpatialQuery.ctx.readShape(o.getLiteralLexicalForm());
+			indexer.add(x, shape);
+		}
+	}
+}

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndexContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message