Spatial Queries/Types

Nov 12, 2014 at 11:36 AM

Love the product, it really has a lot of potential.

Is there support for spatial types in BrightStarDB e.g. the DBGeography type in EF?

I am trying to create an EntityContext for an entity that has a DBGeography type:

public interface IActor
    string Name { get; set; }
    DateTime DateOfBirth { get; set; }
    ICollection<IFilm> Films { get; set; }

    DbGeography geo { get; set; }
However, when I go to generate my context it gives me the following error:
Error 1 Running transformation: Invalid property: ClassLibrary1.IActor.geo - the property type System.Data.Entity.Spatial.DbGeography is not supported by Entity Framework. 1 1

Is there a way around this?


Nov 12, 2014 at 12:57 PM

There isn't any support in B* for geospatial data (yet). I guess the best way to do this would be to develop support for GeoSPARQL, this would almost certainly require some re-engineering both for B* and possibly also for the RDF library we use, plus quite a bit of work to support the SPARQL extension functions and to index the data efficiently.

However, one way to support a basic geospatial location might be to map it to separate RDF properties for latitude, longitude (and altitude if needed) - W3C defines a vocabulary for this (I couldn't find docs, but the RDF file is here). I guess you would type these as decimal or maybe double type properties (which B* will happily handle). You can then add an extension function to convert to/from DBGeography. The only downside would be that to query with LINQ you would need to express your query using the lat/long/alt properties - so doing some of the clever geo-stuff that DBGeography lets you do would be harder. Its not ideal, but I think it would work for simple locations (probably not so good for handling geometries).