Multipolygon support in Lucene .net - geospatial

I am trying to learn lucene .net spatial capabilities .
I want to find if a point exist inside a multi-polygon or not.
From my studies on google, I understand I need to use Net topology suite to describe the multi polygon.
but i am unable to find Lucene.Net.Contrib.Spatial.NTS for the latest version.
Any suggestions (i am using .net core)

A lot of this confusion is centered around a couple of things:
New Lucene Design
Lucene 4.x+ is a completely different design than prior versions. The Lucene.Net.Contrib package is no longer part of that design. Instead, there are now specialized modules for different functionality. In this case, what you are looking for is the Lucene.Net.Spatial assembly.
Spatial4n no longer duplicates types
In Spatial4n 0.3.0, Spatial4n.Core.NTS included copies of all of the types of Spatial4n.Core. This meant that you could not reference both libraries at the same time because they had conflicting type names. It required Lucene.Net.Contrib.Spatial to also duplicate types (in Lucene.Net.Contrib.Spatial.NTS) in order to access the functionality of NetTopologySuite.
Since Spatial4n 0.4.1, Spatial4n.Core types are not included in Spatial4n.Core.NTS. Instead Spatial4n.Core.NTS references Spatial4n.Core.
This means in Lucene.NET 4.8 there is no need to have a separate Lucene.Net.Spatial.NTS library that references Spatial4n.Core.NTS (and its duplicate type system of Spatial4n.Core). However, you can add the NTS functionality to your project by referencing Spatial4n.Core.NTS directly.
<ItemGroup>
<PackageReference Include="Spatial4n.Core" Version="0.4.1" />
<PackageReference Include="Spatial4n.Core.NTS" Version="0.4.1" />
</ItemGroup>
Examples
As Ron C correctly pointed out, there are some basic tests of NetTopologySuite (NTS) functionality in the Lucene.Net 4.8.0 codebase. But as noted above, you need to reference Spatial4n.Core.NTS to access the extensions for NTS.
There are also some additional tests for Spatial4n using NetTopologySuite that can be analyzed.
NtsBinaryCodecTest
NtsWKTReaderShapeParserTest
NtsWktShapeParserTest
NtsGeometryTest
If you need more specific information about the functionality, I suggest you search for the Java examples using the terms "Lucene spatial JTS", "Spatial4j", and "JavaTopologySuite". Since the port is done line-by-line for the most part, the Java examples should be fairly easy to translate to .NET.

I'm not familiar with the specific spatial features of Lucene.Net yet but perhaps this NtsPolygonTest will be of help since it appears to be a test of just the type of functionality you are looking for.
I do see that most of the features for spatial live in the Lucene.Net.Spatial namespace (and below).
Also, it looks like the Spatial features use the Spatial4n nuget package which is a port of the Spacial4J java library.

Related

Parsing GHC Core in ghc-7.10

I am trying to parse some GHC Core to extract name information and other bits needed.
I am currently using the GHC API given that I haven't found other useful packages help with it.
I've looked through some packages like ghc-core, ghc-core-html and extcore but they seem slightly outdated and I haven't managed to use extcore with ghc-7.10.3.
I have also tried to look for up to date documentation on Core without luck. The best post I've come across is this one, but the discussion is slightly outdated (e.g. compiling the example from these slides, gives a different core dump using the latest ghc.
The question
Having said all this, do you guys know of any recent package that can help in parsing Core? Is there any new documentation regarding CORE manipulation?
Thanks!
The external core feature was removed because it was buggy and a hassle to maintain and if people were using it they didn't speak up. So there is no longer any textual representation of Core intended for machine consumption. Only the internal (AST) representation is available. Of course, I'm sure you'd be welcome to revive the external representation if you want to maintain it.

What are the tradeoffs between the Haskell SQLite packages?

There are many Haskell SQLite bindings, which implies to me that there are many different tradeoffs on using building/using a SQLite binding. I've tried to read through the documentation of many of these packages but it became a blur after a while, and I was unable to really identify the primary tradeoffs of choosing one over another.
A search on Hackage finds:
direct-sqlite
HDBC-sqlite3
hdbi-sqlite
hsql-sqlite3
hsSqlite3
persistent-sqlite
simplest-sqlite
sql-simple-sqlite
sqlite
sqlite-simple
sqlite-simple-typed
bindings-sqlite3
Nevermind some "meta" SQLite packages. haskelldb-hdbc-sqlite3, haskelldb-hsql-sqlite3, language-sqlite, opaleye-sqlite
Hoping that someone has been able to do this successfully and can help me understand how to choose.
I looked at the package mentioned. Some of these package are a dependency of another package (like opaleye-sqlite and sqlite-simple) depend on direct-sqlite.
Therefore, let's first look at the package that provide the actual driver. Most of them are outdated. There seem to be 3 that still have recent updates:
https://hackage.haskell.org/package/simplest-sqlite https://github.com/YoshikuniJujo/test_haskell/tree/master/features/ffi/sqlite3/simplest-sqlite i wouldn't use it because the repository says "It's just my private Haskell learning/testing repository."
https://hackage.haskell.org/package/persistent-sqlite this one is based on direct-sqlite (seems like part of the direct-sqlite has been forked)
The last one being the direct-sqlite package. I used this website to find which package depend on direct-sqlite. Now leaving out package that don't have the purpose of working with sqlite (such as bake: Continuous integration system). And also leaving out packages that haven't seen updates in a long time.
That leaves us with the following package that provide extra functionality based on direct-sqlite. This list includes more levels of reverse lookup to see which other package make use of the package listed below.
persistent-sqlite as mentioned before
esqueleto
eventful
groundhog-sqlite
opaleye-sqlite
selda-sqlite
sqlite-simple
beam-sqlite
I've had very good experiences with the ...-simple family of libraries. They are very full-featured and sit at a nice medium level of abstraction where you get a large amount of flexibility over how you intereact with the database.
I'm the author of opaleye-sqlite. It is a somewhat experimental version of Opaleye for SQLite. The Postgres version of Opaleye is very solid and used in production in several places, but I only know of one person who has used opaleye-sqlite in production.

Wildcard assembly reference in csproj

I'm using nuget (as many of you) a lot for referencing external and internal component-assemblies.
For debugging purposes, it would be nice being able to exchange the nuget-assembly for it's source-code.
Unfortunately, some "core-lib" is used pretty often by the solution itself and also some nuget-referenced packages (used by the sln). Simply removing the reference via VS and adding it's source-project often causes an ambigous relation to the "core-lib", because both (sln and package-src) use the "core-lib" - mostly in different versions.
The only way (I know) to solve that issue is to update all references to the same version (usually, the most actual one). That can be pretty annoying, especially in bigger projects.
Maybe there exists a way to make referencing more flexible - e.g. by using wildcards in the hint-path?
Thanks for all suggestions!
Did you try using symbol packages ? More details # http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-symbol-package

How to generate a dependency diagram from a set of XSD files?

See the title: I have around 50 XSD files importing each other (with tags) and I need to analyze their dependencies.
Do you know any software (preferably free) to generate a dependency diagram automatically from these files?
I did not find any existing program to do that, so... I developed my own! It is called GraphVisu.
There is a first program to generate the graph structure from seed XSD files, and another one to visualise graphs. I also included a detection of clusters of interrelated nodes (called "strongly connected components" in graph theory).
Feel free to use it!
I am not aware of any free solution tailored specifically for XSD. If I would have to build it using freely available components, I would probably consider GraphViz. You would need to write a module to generate the data needed by GraphViz which will come from parsing the XSD files. The latter is kind of trivial, if you take into account how schema location works and is resolved, and handle correctly circular dependencies. The good thing is that GraphViz is supported on a wide set of platforms, and as long as you can parse XML, you could be set.
I've also developed my own, in form of an XML Schema Refactoring (XSR) add-on for QTAssistant. This particular feature set has been around since 2004, so it works really well, including WSDL and XSD files.
I can interpret differently what you asked, so I'll refer to what you could do with XSR:
XSD files dependencies
This is a simple one, showing a hierarchical layout.
This is a more complex one, showign an organic layout.
intra-XSD file schema components dependencies: can be filtered on arbitrary criteria (not sure what you meant by with tags).
XSD file set schema components dependencies (same as the above, but one can navigate across different files)
The tool comes with an automation library, where you can write a few lines of C# or Java script code which you can then invoke using QTAssistant shell or a command line shell to integrate it with an automatic build process.
Other features include the ability to export the underlying data using GraphML, that is if you wish to analyse or process the graph further (e.g. topological sorting, cycles, etc.)

Using Dapper in MonoTouch

Since I'm a big fan of Dapper and using it for a couple SQL Azure Projects I would like to use on MonoTouch as well against the built-in Mono.Data.SQLite.
I realize that Dapper's speed comes from the dynamic code generation which unfortunately is a big no-no on iOS where everything has to be compiled ahead-of-time by MonoTouch.
First question: Has anyone made any efforts to provide reflection based implementation of the relevant parts of dapper? (I know it will be a LOT slower) If not how hard would it be to implement it (only glanced over the Dapper source).
Second question: I hope I am not sounding naive here but would it be remotely possible to write a little utility that would materialize the dynamically generated IL for your entity POCOs into an IL assembly source file that could be added to your MonoTouch project and thus gets AOTed during build time? Or is this impossible due to joins and QueryMultiple etc?
Note: I realize there is at least one attempt to port Dapper to MonoTouch but glancing over the source I have no idea how's that supposed to fly since all the dynamic method generation stuff is still in there.

Resources