Not able to import owl file into stardog for GeoSpatial db

Hello,
I have downloaded Stardog Developer version. I have created a db with
stardog-admin db create -o spatial.enabled=true -n mySpatialDb

Now I am trying to import a owl file through Add option. But i keep getting invalid file error. I am able to import this same file in the community version without any error. I see in exceptions some errors regarding GeoSpatial. What more DB setting do I have to use in order to use ? Below are the exceptions

ERROR 2017-04-11 15:45:37,006 [Stardog.Executor-70] com.complexible.tx.api.impl.DefaultTransaction:computePrepareResult(489): There was a fatal failure during preparation of 44216901-d38e-4111-9884-fefd65f59b2e
com.complexible.tx.api.ResourceTransactionException:
at com.complexible.stardog.spatial.db.GeospatialConnectableConnection$GeoTransaction.prepare(GeospatialConnectableConnection.java:275) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.tx.api.BaseResourceTransaction.prepare(BaseResourceTransaction.java:187) ~[stardog-4.2.4.jar:?]
at com.complexible.tx.api.impl.DefaultTransaction.computePrepareResult(DefaultTransaction.java:473) ~[stardog-4.2.4.jar:?]
at com.complexible.tx.api.impl.DefaultTransaction.runPreparePhase(DefaultTransaction.java:439) ~[stardog-4.2.4.jar:?]
at com.complexible.tx.api.impl.DefaultTransaction.commit(DefaultTransaction.java:330) ~[stardog-4.2.4.jar:?]
at com.complexible.stardog.db.DatabaseConnectionImpl.commit(DatabaseConnectionImpl.java:406) ~[stardog-4.2.4.jar:?]
at com.complexible.stardog.db.DatabaseImpl$DBConnectionWrapper.commit(DatabaseImpl.java:1401) ~[stardog-4.2.4.jar:?]
at com.complexible.stardog.db.DelegatingDatabaseConnection.commit(DelegatingDatabaseConnection.java:279) ~[stardog-4.2.4.jar:?]
at com.complexible.stardog.StardogKernel$KernelDbConnection.commit(StardogKernel.java:2760) ~[stardog-4.2.4.jar:?]
at com.complexible.stardog.db.DelegatingDatabaseConnection.commit(DelegatingDatabaseConnection.java:279) ~[stardog-4.2.4.jar:?]
at com.complexible.stardog.StardogKernel$NotifyingDatabaseConnection.commit(StardogKernel.java:3028) ~[stardog-4.2.4.jar:?]
at com.complexible.stardog.protocols.server.SPECServerFunction.commitTx(SPECServerFunction.java:376) ~[stardog-protocols-spec-server-4.2.4.jar:?]
at com.complexible.stardog.protocols.server.SPECServerFunction.handleMessage(SPECServerFunction.java:167) ~[stardog-protocols-spec-server-4.2.4.jar:?]
at com.complexible.common.protocols.server.rpc.ServerHandler.lambda$handleMessage$1(ServerHandler.java:311) ~[stardog-protocols-api-server-4.2.4.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_77]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_77]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_77]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_77]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_77]
Caused by: com.complexible.stardog.spatial.GeoException: com.complexible.stardog.spatial.GeoException: java.lang.IllegalArgumentException: Unsupported shape class com.spatial4j.core.shape.impl.BufferedLineString
at com.complexible.stardog.spatial.io.StatementSourceGeospatialSource.parse(StatementSourceGeospatialSource.java:146) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.db.GeospatialConnectable.reindex(GeospatialConnectable.java:157) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.db.GeospatialConnectableConnection.reindex(GeospatialConnectableConnection.java:170) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.db.GeospatialConnectableConnection$GeoTransaction.prepare(GeospatialConnectableConnection.java:267) ~[stardog-spatial-core-4.2.4.jar:?]
… 18 more
Caused by: com.complexible.stardog.spatial.GeoException: java.lang.IllegalArgumentException: Unsupported shape class com.spatial4j.core.shape.impl.BufferedLineString
at com.complexible.stardog.spatial.impl.LuceneGeospatialIndexConnection.add(LuceneGeospatialIndexConnection.java:380) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.db.GeospatialConnectable.lambda$reindex$0(GeospatialConnectable.java:159) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.io.StatementSourceGeospatialSource.parse(StatementSourceGeospatialSource.java:90) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.db.GeospatialConnectable.reindex(GeospatialConnectable.java:157) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.db.GeospatialConnectableConnection.reindex(GeospatialConnectableConnection.java:170) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.db.GeospatialConnectableConnection$GeoTransaction.prepare(GeospatialConnectableConnection.java:267) ~[stardog-spatial-core-4.2.4.jar:?]
… 18 more
Caused by: java.lang.IllegalArgumentException: Unsupported shape class com.spatial4j.core.shape.impl.BufferedLineString
at com.spatial4j.core.io.BinaryCodec.writeShape(BinaryCodec.java:70) ~[spatial4j-0.4.1.jar:?]
at com.complexible.stardog.spatial.Shapes.write(Shapes.java:43) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.impl.LuceneSpatialIndexes.lambda$toDocument$0(LuceneSpatialIndexes.java:53) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.impl.LuceneGeospatialIndexConnection.add(LuceneGeospatialIndexConnection.java:376) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.db.GeospatialConnectable.lambda$reindex$0(GeospatialConnectable.java:159) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.io.StatementSourceGeospatialSource.parse(StatementSourceGeospatialSource.java:90) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.db.GeospatialConnectable.reindex(GeospatialConnectable.java:157) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.db.GeospatialConnectableConnection.reindex(GeospatialConnectableConnection.java:170) ~[stardog-spatial-core-4.2.4.jar:?]
at com.complexible.stardog.spatial.db.GeospatialConnectableConnection$GeoTransaction.prepare(GeospatialConnectableConnection.java:267) ~[stardog-spatial-core-4.2.4.jar:?]
… 18 more

You need to include the jts jar and enable it by setting spatial.use.jts https://docs.stardog.com/#_enhanced_polygons

Thanks for the info. I have created the properties file with this option enabled. However, stardog does not return any result for my GeoSPARQL query.

My Query is

PREFIX geof: http://www.opengis.net/def/function/geosparql/
PREFIX units: http://www.opengis.net/def/uom/OGC/1.0/

SELECT *
WHERE {
ont:N10 geo:asWKT ?p1.
ont:N11 geo:asWKT ?p2
bind(geof:distance(?p1,?p2,units:metre) as ?dist)
}

With the spatial.use.jts option enabled, Stardog can find the ‘geof:distance’ function. But it does not return any result. I can execute the same query successfully in Parliament triple store.

What prefix did you use for geo:? Anything in the logs?

PREFIX geo: http://www.opengis.net/ont/geosparql#
No error or exception in logs.

Hi,

Do you get results if instead of

ont:N10 geo:asWKT ?p1.
ont:N11 geo:asWKT ?p2

you use this?

ont:N10 geo:hasGeometry ?p1.
ont:N11 geo:hasGeometry ?p2

As shown in the docs (https://docs.stardog.com/#_geospatial_data), the expected data format is:

:MyFeature a geo:Feature ;
  geo:hasGeometry [
    a geo:Geometry ;
    geo:asWKT :MyWktLiteral
  ]

and the object of geo:hasGeometry is what is used in the geof functions.

I wrote query like below and it worked

SELECT *
WHERE {
ont:N10 geo:asWKT ?p1.
ont:N11 geo:asWKT ?p2
bind(geof:distance(ont:N10,ont:N11,units:metre) as ?dist)
}

Result:
p1 p2 dist
POINT(10.0219981 48.4323420) POINT(10.0216530 48.4317078) 74.9754995429176

Thank you all for help!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.