@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix geof: <http://www.opengis.net/def/function/geosparql/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix geo: <http://www.opengis.net/ont/geosparql#> .
<urn:rede/geodata/resource/18955c8b-61f0-4549-988e-0b1e1ea132d5> a geo:Geometry ;
<urn:rede/properties#uuid> "18955c8b-61f0-4549-988e-0b1e1ea132d5" ;
geo:asWKT "POINT(7.861 52.812)"^^geo:wktLiteral .
<urn:rede/geodata/resource/3b9d8275-4b1b-4f5f-a823-cfa8f69343a6> a geo:Geometry ;
<urn:rede/properties#uuid> "3b9d8275-4b1b-4f5f-a823-cfa8f69343a6" ;
geo:asWKT "POINT(8.703 50.735)"^^geo:wktLiteral .
<urn:rede/geodata/resource/3b9d8275-4b1b-4f5f-a823-cfa8f69343a9> a geo:Geometry ;
<urn:rede/properties#uuid> "3b9d8275-4b1b-4f5f-a823-cfa8f69343a9" ;
geo:asWKT "POINT(8.703 50.735)"^^geo:wktLiteral .
bin/stardog-admin db create -o spatial.enabled=true spatial.use.jts=true -n g1 geosparqltest.ttl
bin/stardog-admin db create -o spatial.enabled=true -n g2 geosparqltest.ttl
Bulk loading data to new database g2.
Loaded 9 triples to g2 from 1 file(s) in 00:00:00.058 @ 0,2K triples/sec.
Successfully created database 'g2'.
ERROR 2015-10-07 15:38:26,729 [SPEC-Server-1-1] com.complexible.stardog.protocols.server.SPECServerFunction:query(523): There was an error executing query: prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select * where {
?loc geof:nearby (?hq 2 <http://www.qudt.org/qudt/owl/1.0.0/unit/Instances.html#Kilometer> ).
} limit 50 offset 0
org.openrdf.query.QueryEvaluationException: com.complexible.stardog.plan.eval.ExecutionException: There was an error while creating a new query plan
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:226) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:209) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.protocols.server.SPECServerFunction.query(SPECServerFunction.java:499) [stardog-protocols-spec-server-4.0-RC1.jar:?]
at com.complexible.stardog.protocols.server.SPECServerFunction.handleMessage(SPECServerFunction.java:149) [stardog-protocols-spec-server-4.0-RC1.jar:?]
at com.complexible.stardog.protocols.http.annex.QueryPanelEndpoint.handleMessage(QueryPanelEndpoint.java:89) [stardog-webconsole-annex-4.0-RC1.jar:?]
at com.complexible.common.protocols.server.rpc.ServerHandler.handleMessage(ServerHandler.java:295) [stardog-protocols-api-server-4.0-RC1.jar:?]
at com.complexible.common.protocols.server.rpc.ServerHandler.channelRead(ServerHandler.java:187) [stardog-protocols-api-server-4.0-RC1.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) [netty-all-4.0.30.Final.jar:4.0.30.Final]
at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:32) [netty-all-4.0.30.Final.jar:4.0.30.Final]
at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:299) [netty-all-4.0.30.Final.jar:4.0.30.Final]
at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:36) [netty-all-4.0.30.Final.jar:4.0.30.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:110) [netty-all-4.0.30.Final.jar:4.0.30.Final]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [netty-all-4.0.30.Final.jar:4.0.30.Final]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]
Caused by: com.complexible.stardog.plan.eval.ExecutionException: There was an error while creating a new query plan
at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:219) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:119) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:223) ~[stardog-4.0-RC1.jar:?]
... 13 more
Caused by: com.complexible.stardog.plan.PlanException: There was an error while creating a new query plan
at com.complexible.stardog.plan.PlanGenerator.createPlan(PlanGenerator.java:720) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.PlanGenerator.createPlan(PlanGenerator.java:670) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.PlanContext.planFor(PlanContext.java:85) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:199) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:119) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:223) ~[stardog-4.0-RC1.jar:?]
... 13 more
Caused by: java.lang.IllegalStateException: http://www.qudt.org/qudt/owl/1.0.0/unit/Instances.html#Kilometer is not a known unit.
at com.complexible.stardog.spatial.db.query.NearbyPropertyFunction$NearbyPlanNodeBuilder.validate(NearbyPropertyFunction.java:217) ~[stardog-spatial-core-4.0-RC1.jar:?]
at com.complexible.stardog.plan.AbstractPlanNodeBuilder.build(AbstractPlanNodeBuilder.java:94) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.AbstractPropertyFunctionNodeBuilder.build(AbstractPropertyFunctionNodeBuilder.java:21) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.PropertyFunctions$PropertyFunctionReplacer.transform(PropertyFunctions.java:284) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:670) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.ScopeNodeImpl.accept(ScopeNodeImpl.java:122) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.unaryVisit(TransformingPlanNodeVisitor.java:518) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.unaryTransform(TransformingPlanNodeVisitor.java:78) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:305) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:726) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.ProjectionPlanNodeImpl.accept(ProjectionPlanNodeImpl.java:107) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.unaryVisit(TransformingPlanNodeVisitor.java:518) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.unaryTransform(TransformingPlanNodeVisitor.java:78) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:315) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:718) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.SlicePlanNodeImpl.accept(SlicePlanNodeImpl.java:103) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.PropertyFunctions.apply(PropertyFunctions.java:168) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.PlanGenerator$PlanBuilder.build(PlanGenerator.java:969) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.PlanGenerator.createPlan(PlanGenerator.java:715) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.PlanGenerator.createPlan(PlanGenerator.java:670) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.PlanContext.planFor(PlanContext.java:85) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:199) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:119) ~[stardog-4.0-RC1.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:223) ~[stardog-4.0-RC1.jar:?]
... 13 more
Hello,I have some problems getting the geospatial extension to work.First:It seems that the geospatial extension is disabled in the community edition. It accepts the parameters on db creation but does not create a spatial index like the developer+ version.
Second:Either I am doing something wrong or the spatial.use.jts option does not work.I get "Invalid configuration option: spatial.use.jts." when I try to create a database with this option. I simply drop the JTS jars in the server/dbms folder, perhaps I need to include them in the CLASSPATH explicitly.(According to jinfo <ps> the jts-1.8 is in the CLASSPATH)
It seems that the qudt: namespace is unknown.This query works but returns no results:
This query produces a NullPointerException and no stardog.log entrywhich is probably not wrong, because Points should not have an area but still confusing.
This does not produce an error but also no result
Also I have some confusion with the namespace.Usually the geo namespace is <http://www.opengis.net/ont/geosparql#> which denotes all the classes and concepts and basic relations that can be used in a GraphPattern while thegeof: <http://www.opengis.net/def/function/geosparql/> namespace contains the functions that can be used in filters.In the example in the docs the geof namespace is used in GraphPattern and as a prefix for :hasGeometry.(This seems to be partly fixed, "The operators supported... still has the geo: namspace)
Right now it is very unclear for me, how to use the implemented relations or functions and which relations/functions are actually implemented and can be used in a filter or a graph pattern. For example: geof:relate is more Jack of all Trades function, which connects two geo:geomLiterals via the DE-9IM Matrix while geof:nearby does not seem to be part of the official geosparql standard.
I think it would be very help full to have a working "copy and paste" example on the website and a list with all the implemented functions and its signatures similar to the Appendix -> SPARQL Query Functions.Greetings,Robert Engsterhold
--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en
bin/stardog-admin db create -c <path-to-geotest>/playground-config.properties <path-to-geotest>/*.ttl
prefix geo: <http://www.opengis.net/ont/geosparql#>
prefix geof: <http://www.opengis.net/def/function/geosparql/>
select * where {
?featureFix geo:hasGeometry ?geomFix ; rdfs:label ?nameFix .
?featureVar geo:hasGeometry ?geomVar ; rdfs:label ?nameComp .
#?geomVar geof:nearby (?geomFix 95 <http://qudt.org/vocab/unit#Kilometer>). #1 Var -> Fix
#?geomFix geof:nearby (?geomVar 95 <http://qudt.org/vocab/unit#Kilometer>). #2 Fix -> Var
#?dist geof:distance (?geomFix ?geomVar <http://qudt.org/vocab/unit#Kilometer>) . #3 Dist (Fix, Var)
#?dist geof:distance (?geomVar ?geomFix <http://qudt.org/vocab/unit#Kilometer>) . #4 Dist (Var, Fix)
#?geomFix geof:within (?geomVar). #5 Fix within Var
#?geomVar geof:within (?geomFix). #6 Var within Fix
#?rel geof:relate (?geomVar ?geomFix). #7 rel (Var, Fix)
#?rel geof:relate (?geomFix ?geomVar). #8 rel (Fix, Var)
#?area geof:area (?geomVar <http://qudt.org/vocab/unit#Kilometer>) . #9 Area Var
#?area geof:area (?geomFix <http://qudt.org/vocab/unit#Kilometer>) . #10 Area Fix
} values (?featureFix) {
(<urn:goettingen-feature>) #A
#(<urn:berlin-feature>) # B
}
com.complexible.stardog.plan.eval.ExecutionException: There was an error while creating a new
query plan
ERROR 2015-11-24 12:19:56,296 [SPEC-Server-1-3] com.complexible.stardog.protocols.server.SPECServerFunction:query(527): There was an error executing query: prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix geo: <http://www.opengis.net/ont/geosparql#>
prefix geof: <http://www.opengis.net/def/function/geosparql/>
select * where {
?featureFix geo:hasGeometry ?geomFix ; rdfs:label ?nameFix .
?featureVar geo:hasGeometry ?geomVar ; rdfs:label ?nameComp .
?geomVar geof:nearby (<urn:goettingen-geometry> 95 <http://qudt.org/vocab/unit#Kilometer>). #1 Var -> Fix
#?geomFix geof:nearby (?geomVar 95 <http://qudt.org/vocab/unit#Kilometer>). #2 Fix -> Var
#?dist geof:distance (?geomFix ?geomVar <http://qudt.org/vocab/unit#Kilometer>) . #3 Dist (Fix, Var)
#?dist geof:distance (?geomVar ?geomFix <http://qudt.org/vocab/unit#Kilometer>) . #4 Dist (Var, Fix)
#?geomFix geof:within (?geomVar). #5 Fix within Var
#?geomVar geof:within (?geomFix). #6 Var within Fix
#?rel geof:relate (?geomVar ?geomFix). #7 rel (Var, Fix)
#?rel geof:relate (?geomFix ?geomVar). #8 rel (Fix, Var)
#?area geof:area (?geomVar <http://qudt.org/vocab/unit#Kilometer>) . #9 Area Var
#?area geof:area (?geomFix <http://qudt.org/vocab/unit#Kilometer>) . #10 Area Fix
} values (?featureFix) {
(<urn:goettingen-feature>) #A
(<urn:berlin-feature>) # B
}
org.openrdf.query.QueryEvaluationException: com.complexible.stardog.plan.eval.ExecutionException: There was an error while creating a new
query plan
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:226) ~[stardog-4.0.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:209) ~[stardog-4.0.jar:?]
at com.complexible.stardog.protocols.server.SPECServerFunction.query(SPECServerFunction.java:503) [stardog-protocols-spec-server-4.0.jar:?]
at com.complexible.stardog.protocols.server.SPECServerFunction.handleMessage(SPECServerFunction.java:149) [stardog-protocols-spec-server-4.0.jar:?]
at com.complexible.stardog.protocols.http.annex.QueryPanelEndpoint.handleMessage(QueryPanelEndpoint.java:89) [stardog-webconsole-annex-4.0.jar:?]
at com.complexible.common.protocols.server.rpc.ServerHandler.handleMessage(ServerHandler.java:324) [stardog-protocols-api-server-4.0.jar:?]
at com.complexible.common.protocols.server.rpc.ServerHandler.channelRead(ServerHandler.java:207) [stardog-protocols-api-server-4.0.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) [netty-all-4.0.32.Final.jar:4.0.32.Final]
at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:32) [netty-all-4.0.32.Final.jar:4.0.32.Final]
at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:299) [netty-all-4.0.32.Final.jar:4.0.32.Final]
at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:36) [netty-all-4.0.32.Final.jar:4.0.32.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [netty-all-4.0.32.Final.jar:4.0.32.Final]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [netty-all-4.0.32.Final.jar:4.0.32.Final]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]
Caused by: com.complexible.stardog.plan.eval.ExecutionException: There was an error while creating a new
query plan
at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:223) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:120) ~[stardog-4.0.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:223) ~[stardog-4.0.jar:?]
... 13 more
Caused by: com.complexible.stardog.plan.PlanException: There was an error while creating a new
query plan
at com.complexible.stardog.plan.PlanGenerator.createPlan(PlanGenerator.java:656) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PlanGenerator.createPlan(PlanGenerator.java:608) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PlanContext.planFor(PlanContext.java:85) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:200) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:120) ~[stardog-4.0.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:223) ~[stardog-4.0.jar:?]
... 13 more
Caused by: java.lang.IllegalStateException: Expected a variable or a wktLiteral typed literal
at com.complexible.stardog.spatial.db.query.SpatialQueries.assertWktLiteralOrVariable(SpatialQueries.java:94) ~[stardog-spatial-core-4.0.jar:?]
at com.complexible.stardog.spatial.db.query.NearbyPropertyFunction$NearbyPlanNodeBuilder.validate(NearbyPropertyFunction.java:174) ~[stardog-spatial-core-4.0.jar:?]
at com.complexible.stardog.plan.AbstractPlanNodeBuilder.build(AbstractPlanNodeBuilder.java:94) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.AbstractPropertyFunctionNodeBuilder.build(AbstractPropertyFunctionNodeBuilder.java:20) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PropertyFunctions$PropertyFunctionReplacer.lambda$transform$83(PropertyFunctions.java:236) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PropertyFunctions$PropertyFunctionReplacer$$Lambda$166/1158343024.accept(Unknown Source) ~[?:?]
at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_45]
at com.complexible.stardog.plan.PropertyFunctions$PropertyFunctionReplacer.transform(PropertyFunctions.java:218) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:680) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.ScopeNodeImpl.accept(ScopeNodeImpl.java:122) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.unaryVisit(TransformingPlanNodeVisitor.java:528) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.unaryTransform(TransformingPlanNodeVisitor.java:78) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:305) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:736) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.ProjectionPlanNodeImpl.accept(ProjectionPlanNodeImpl.java:107) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PropertyFunctions.apply(PropertyFunctions.java:168) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PlanGenerator$PlanBuilder.build(PlanGenerator.java:785) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PlanGenerator.createPlan(PlanGenerator.java:651) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PlanGenerator.createPlan(PlanGenerator.java:608) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PlanContext.planFor(PlanContext.java:85) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:200) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:120) ~[stardog-4.0.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:223) ~[stardog-4.0.jar:?]
... 13 more
prefix geo: <http://www.opengis.net/ont/geosparql#>
prefix geof: <http://www.opengis.net/def/function/geosparql/>
select * where { ?geomFix geof:nearby (?geomVar 95 <http://qudt.org/vocab/unit#Kilometer>)}
prefix geo: <http://www.opengis.net/ont/geosparql#>
prefix geof: <http://www.opengis.net/def/function/geosparql/>
select * where {
?featureVar geo:hasGeometry ?geomVar ; rdfs:label ?nameComp .
?geomFix geof:nearby (?geomVar 95 <http://qudt.org/vocab/unit#Kilometer>).
}
Hi,I have also made some test with the new geospatial functions and stumbled on some oddities.
I have created a simple testset and run them against stardog4 (17.10.2015) on a macbook pro 13' (2015) and java version "1.8.0_45"
The attached zip includes some ttl with Features and some tsv files with the result to helpful postgis queries.
Lower_Saxony.ttl contains the urn:mph-[feature | geometry] that is the federal state of Lower Saxony in Germany represented as a Multipolygon with a hole.ConvexHull_of_Lower_Saxony.ttl, Bounding_Box_of_Lower_Saxony.ttlcontain the ,well, convex hull and bounding box of the geometry.without the jts-1.12 or 1.13 in your stardog/server/dbms folder and spatial.use.jts=true in your stardog.properties you can only load the Bounding_Box_of_Lower_Saxony.ttlThen some Cities represented as Points:Bremen.ttl : is within the convex hull and bounding box of Lower Saxony but not in Lower Saxony itself (its in the "hole")Berlin.ttl is outside of everythingGoettingen.ttl, Hannover.tll is inside everything.All these features are also in dataset_with_graphs.nq, but there seems to be a BUG, that loading a quad does not trigger the creation of the spatial index.
But if i add a second value to geomFix by uncommenting #B (and #1), I get way less results but still some false
featureFix geomFix nameFix featureVar geomVar nameComp
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:ch-feature urn:ch-geometry ConvexHull of Lower Saxony
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:bb-feature urn:bb-geometry Bounding Box of Lower Saxony
urn:berlin-feature urn:berlin-geometry Berlin urn:berlin-feature urn:berlin-geometry Berlin
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:goettingen-feature urn:goettingen-geometry Goettingen
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:hannover-feature urn:hannover-geometry Hannover
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:mph-feature urn:mph-geometry Lower SaxonyUncommenting #B and #2 returns the expected results
featureFix geomFix nameFix featureVar geomVar nameComp
urn:berlin-feature urn:berlin-geometry Berlin urn:berlin-feature urn:berlin-geometry Berlin
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:goettingen-feature urn:goettingen-geometry Goettingen
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:hannover-feature urn:hannover-geometry Hannoverfor #3, #4 there seems to be the same problem, that variables lose there binding in the brackets
#5 works as expected, #6 returns all combinations of within#7 returns all combination. If I also activated #B I get the expected results for berlin and goettingen
featureFix geomFix nameFix featureVar geomVar nameComp rel
urn:berlin-feature urn:berlin-geometry Berlin urn:ch-feature urn:ch-geometry ConvexHull of Lower Saxony ns1:disjoint
urn:berlin-feature urn:berlin-geometry Berlin urn:bb-feature urn:bb-geometry Bounding Box of Lower Saxony ns1:disjoint
urn:berlin-feature urn:berlin-geometry Berlin urn:hannover-feature urn:hannover-geometry Hannover ns1:disjoint
urn:berlin-feature urn:berlin-geometry Berlin urn:goettingen-feature urn:goettingen-geometry Goettingen ns1:disjoint
urn:berlin-feature urn:berlin-geometry Berlin urn:bremen-feature urn:bremen-geometry Bremen ns1:disjoint
urn:berlin-feature urn:berlin-geometry Berlin urn:mph-feature urn:mph-geometry Lower Saxony ns1:disjoint
urn:berlin-feature urn:berlin-geometry Berlin urn:berlin-feature urn:berlin-geometry Berlin ns1:equals
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:goettingen-feature urn:goettingen-geometry Goettingen ns1:equals
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:ch-feature urn:ch-geometry ConvexHull of Lower Saxony ns1:contains
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:bremen-feature urn:bremen-geometry Bremen ns1:disjoint
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:berlin-feature urn:berlin-geometry Berlin ns1:disjoint
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:bb-feature urn:bb-geometry Bounding Box of Lower Saxony ns1:contains
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:hannover-feature urn:hannover-geometry Hannover ns1:disjoint
urn:goettingen-feature urn:goettingen-geometry Goettingen urn:mph-feature urn:mph-geometry Lower Saxony ns1:containsSome for #8 with and without #B#10 returns results for an unbound geomFix
if i replace ?geomFix with <urn:goettingen-geometry> in ,for example, #1i get following error:
com.complexible.stardog.plan.eval.ExecutionException: There was an error while creating a new
query plan
ERROR 2015-11-24 12:19:56,296 [SPEC-Server-1-3] com.complexible.stardog.protocols.server.SPECServerFunction:query(527): There was an error executing query: prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix geof: <http://www.opengis.net/def/function/geosparql/>
select * where {
?featureFix geo:hasGeometry ?geomFix ; rdfs:label ?nameFix .
?featureVar geo:hasGeometry ?geomVar ; rdfs:label ?nameComp .
?geomVar geof:nearby (<urn:goettingen-geometry> 95 <http://qudt.org/vocab/unit#Kilometer>). #1 Var -> Fix
#?geomFix geof:nearby (?geomVar 95 <http://qudt.org/vocab/unit#Kilometer>). #2 Fix -> Var
#?dist geof:distance (?geomFix ?geomVar <http://qudt.org/vocab/unit#Kilometer>) . #3 Dist (Fix, Var)
#?dist geof:distance (?geomVar ?geomFix <http://qudt.org/vocab/unit#Kilometer>) . #4 Dist (Var, Fix)
#?geomFix geof:within (?geomVar). #5 Fix within Var
#?geomVar geof:within (?geomFix). #6 Var within Fix
#?rel geof:relate (?geomVar ?geomFix). #7 rel (Var, Fix)
#?rel geof:relate (?geomFix ?geomVar). #8 rel (Fix, Var)
#?area geof:area (?geomVar <http://qudt.org/vocab/unit#Kilometer>) . #9 Area Var
#?area geof:area (?geomFix <http://qudt.org/vocab/unit#Kilometer>) . #10 Area Fix
} values (?featureFix) {
(<urn:goettingen-feature>) #A
(<urn:berlin-feature>) # B
}
org.openrdf.query.QueryEvaluationException: com.complexible.stardog.plan.eval.ExecutionException: There was an error while creating a new
query plan
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:226) ~[stardog-4.0.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:209) ~[stardog-4.0.jar:?]
at com.complexible.stardog.protocols.server.SPECServerFunction.query(SPECServerFunction.java:503) [stardog-protocols-spec-server-4.0.jar:?]
at com.complexible.stardog.protocols.server.SPECServerFunction.handleMessage(SPECServerFunction.java:149) [stardog-protocols-spec-server-4.0.jar:?]
at com.complexible.stardog.protocols.http.annex.QueryPanelEndpoint.handleMessage(QueryPanelEndpoint.java:89) [stardog-webconsole-annex-4.0.jar:?]
at com.complexible.common.protocols.server.rpc.ServerHandler.handleMessage(ServerHandler.java:324) [stardog-protocols-api-server-4.0.jar:?]
at com.complexible.common.protocols.server.rpc.ServerHandler.channelRead(ServerHandler.java:207) [stardog-protocols-api-server-4.0.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) [netty-all-4.0.32.Final.jar:4.0.32.Final]
at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:32) [netty-all-4.0.32.Final.jar:4.0.32.Final]
at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:299) [netty-all-4.0.32.Final.jar:4.0.32.Final]
at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:36) [netty-all-4.0.32.Final.jar:4.0.32.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [netty-all-4.0.32.Final.jar:4.0.32.Final]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [netty-all-4.0.32.Final.jar:4.0.32.Final]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]
Caused by: com.complexible.stardog.plan.eval.ExecutionException: There was an error while creating a new
query plan
at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:223) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:120) ~[stardog-4.0.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:223) ~[stardog-4.0.jar:?]
... 13 more
Caused by: com.complexible.stardog.plan.PlanException: There was an error while creating a new
query plan
at com.complexible.stardog.plan.PlanGenerator.createPlan(PlanGenerator.java:656) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PlanGenerator.createPlan(PlanGenerator.java:608) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PlanContext.planFor(PlanContext.java:85) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:200) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:120) ~[stardog-4.0.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:223) ~[stardog-4.0.jar:?]
... 13 more
Caused by: java.lang.IllegalStateException: Expected a variable or a wktLiteral typed literal
at com.complexible.stardog.spatial.db.query.SpatialQueries.assertWktLiteralOrVariable(SpatialQueries.java:94) ~[stardog-spatial-core-4.0.jar:?]
at com.complexible.stardog.spatial.db.query.NearbyPropertyFunction$NearbyPlanNodeBuilder.validate(NearbyPropertyFunction.java:174) ~[stardog-spatial-core-4.0.jar:?]
at com.complexible.stardog.plan.AbstractPlanNodeBuilder.build(AbstractPlanNodeBuilder.java:94) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.AbstractPropertyFunctionNodeBuilder.build(AbstractPropertyFunctionNodeBuilder.java:20) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PropertyFunctions$PropertyFunctionReplacer.lambda$transform$83(PropertyFunctions.java:236) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PropertyFunctions$PropertyFunctionReplacer$$Lambda$166/1158343024.accept(Unknown Source) ~[?:?]
at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_45]
at com.complexible.stardog.plan.PropertyFunctions$PropertyFunctionReplacer.transform(PropertyFunctions.java:218) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:680) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.ScopeNodeImpl.accept(ScopeNodeImpl.java:122) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.unaryVisit(TransformingPlanNodeVisitor.java:528) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.unaryTransform(TransformingPlanNodeVisitor.java:78) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:305) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:736) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.ProjectionPlanNodeImpl.accept(ProjectionPlanNodeImpl.java:107) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PropertyFunctions.apply(PropertyFunctions.java:168) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PlanGenerator$PlanBuilder.build(PlanGenerator.java:785) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PlanGenerator.createPlan(PlanGenerator.java:651) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PlanGenerator.createPlan(PlanGenerator.java:608) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.PlanContext.planFor(PlanContext.java:85) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:200) ~[stardog-4.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:120) ~[stardog-4.0.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:223) ~[stardog-4.0.jar:?]
... 13 more
Also a simpleprefix geo: <http://www.opengis.net/ont/geosparql#>prefix geof: <http://www.opengis.net/def/function/geosparql/>select * where { ?geomFix geof:nearby (?geomVar 95 <http://qudt.org/vocab/unit#Kilometer>)}returns 0 results.I need to bind at least the ?geomVar to a geo:Geometry:prefix geo: <http://www.opengis.net/ont/geosparql#>prefix geof: <http://www.opengis.net/def/function/geosparql/>select * where {?featureVar geo:hasGeometry ?geomVar ; rdfs:label ?nameComp .?geomFix geof:nearby (?geomVar 95 <http://qudt.org/vocab/unit#Kilometer>).}returns all combinations (as expected)
It seems that the geospatial function need a bound geometry inside the brackets, but lose the binding somehow during processing
I hope this helps somehow,