The rdflib output now shows ^^ on the literals so something has changed. maybe it does not print the URI the way you are printing the data.

The rdflib project prefer their questions to go to stackoverflow with the tag "rdflib" but before that the URIs for functions and properties need sorting out.

GEO[] isn't provided by rdflib.

    Andy

On 19/04/2020 12:44, Lorenz Buehmann wrote:
why are you asking about Python based rdflib code on this mailing list?
I mean, it's a totally different API. And what is the purpose of the code?

honestly, you should start with a minimal example. Load a sample of RDF
triples with the correct datatype, then try the queries. You should also
check again about GeoSPARQL.

Also, in the specs the URI is geo:sfEquals for the propertyand
geof:sfEquals to use it as a function. Where did you read about the
usage of the URI geo:equals ?


And as Andy already pointed out, the literal that you use for matching
also needs the datatype.

On 18.04.20 18:47, manoj deshpande wrote:
I am trying to convert "POLYGON(())" wkt value from string to "wktLiteral"
as suggested above in below code (python rdflib).

if name == "wkt":
     self._graph.add((image, GEO["asWKT"], rl.Literal(value,
datatype=GEO["wktLiteral"])))


  Is it right method ?

As I see below values when I execute query. The wktliteral value is
not appended in the end.


"POLYGON((8.461714982986452 48.997849415191105,8.461714982986452
48.99797963751407,8.461988568305971
48.99797963751407,8.461988568305971
48.997849415191105,8.461714982986452 48.997849415191105))"^^


Thanks,

Manoj


On Sat, Apr 18, 2020 at 3:47 PM Andy Seaborne <[email protected]> wrote:

The literal need to have a datatype

"POLYGON((...))"^^<http://www.opengis.net/ont/geosparql#wktLiteral>

judging by your first message, they are strings.

      Andy

On 18/04/2020 13:03, manoj deshpande wrote:
I tried below query as per suggestion, But this also returns me no
results.
Is the query is right ??

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://example.org/#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX spatial: <http://jena.apache.org/spatial#>
SELECT ?object
WHERE {
GRAPH <http://project/base/default> {
      ?subject geo:asWKT ?object FILTER ( geo:equals(?object,
"POLYGON((8.463699817657472 48.99872928913063,8.463887572288515
48.998644821906865,8.46399486064911 48.998764483764916,8.46425771713257
48.99865538031766,8.464375734329225 48.998746886450874,8.463919758796694
48.99893693711346,8.463699817657472 48.99872928913063))"))
} }


*Results*

{
    "head": {
      "vars": [ "object" ]
    } ,
    "results": {
      "bindings": [

      ]
    }
}

Thanks & Regards
Manoj

On Sat, Apr 18, 2020 at 12:27 PM Lorenz Buehmann <
[email protected]> wrote:

geo:equals is a filter function and not a property function. This means
it returns a boolean value, thus, you have to use it in a FILTER

(untested)

FILTER(geo:equals(?object,
                                "POLYGON((8.463699817657472
48.99872928913063,8.463887572288515 48.998644821906865,8.46399486064911
48.998764483764916,8.46425771713257 48.99865538031766,8.464375734329225
48.998746886450874,8.463919758796694 48.99893693711346,8.463699817657472
48.99872928913063))"
                                )
             )


On 18.04.20 12:19, manoj deshpande wrote:
I am using Apache Jena Fuseki Server for Storing Geo Coordinates of
location. How to find out that if two polygons or two rectangles
intersect each other inside Fuseki.

I have stored geocoordinates in WKT serialization format. When I
execute below query

|*PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX rdf:
<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX geo:
<http://www.opengis.net/ont/geosparql#> PREFIX xsd:
<http://www.w3.org/2001/XMLSchema#> PREFIX rdfs:
<http://www.w3.org/2000/01/rdf-schema#> PREFIX :
<http://example.org/#> PREFIX geo:
<http://www.opengis.net/ont/geosparql#> PREFIX spatial:
<http://jena.apache.org/spatial#> SELECT ?object WHERE { GRAPH
<http://project/base/default> { ?subject geo:asWKT ?object . } }*|||
I get these below results.
|object 1 "POLYGON((8.463699817657472
48.99872928913063,8.463887572288515
48.998644821906865,8.46399486064911
48.998764483764916,8.46425771713257
48.99865538031766,8.464375734329225
48.998746886450874,8.463919758796694
48.99893693711346,8.463699817657472 48.99872928913063))" 2
"POLYGON((8.463560342788698 48.99847940651206,8.463560342788698
48.99864834137738,8.46377491950989 48.99864834137738,8.46377491950989
48.99847940651206,8.463560342788698 48.99847940651206))" 3
"POLYGON((8.463447690010073 48.99835974396915,8.463447690010073
48.99849348443939,8.463646173477175
48.99849348443939,8.463646173477175
48.99835974396915,8.463447690010073 48.99835974396915))" 4
"POLYGON((8.463254570961 48.99821544463795,8.463254570961
48.99838438039854,8.463635444641115
48.99838438039854,8.463635444641115 48.99821544463795,8.463254570961
48.99821544463795))" 5 "POLYGON((8.463689088821413
48.99826823712468,8.463689088821413 48.99845477012966,8.46402168273926
48.99845477012966,8.46402168273926 48.99826823712468,8.463689088821413
48.99826823712468))" 6 "POLYGON((8.463892936706545
48.99843013373508,8.463892936706545
48.998588510344774,8.464316725730898
48.998588510344774,8.464316725730898
48.99843013373508,8.463892936706545 48.99843013373508))" 7
"POLYGON((8.463093638420107 48.99805354732974,8.463093638420107
48.998243600637835,8.463737368583681
48.998243600637835,8.463737368583681
48.99805354732974,8.463093638420107 48.99805354732974))" 8
"POLYGON((8.463619351387026 48.99797963751407,8.463619351387026
48.998180249615714,8.464118242263796
48.998180249615714,8.464118242263796
48.99797963751407,8.463619351387026 48.99797963751407))" 9
"POLYGON((8.464407920837404 48.998303432084754,8.464407920837404
48.99857443244431,8.46477270126343 48.99857443244431,8.46477270126343
48.998303432084754,8.464407920837404 48.998303432084754))" 10
"POLYGON((8.464225530624391 48.99806762537742,8.464225530624391
48.99839141937611,8.464820981025698
48.99839141937611,8.464820981025698
48.99806762537742,8.464225530624391 48.99806762537742))"|
|Then later I want to filter out these geo:WKT objects based on
geo:intersection (Intersection or equals or contains methods). And I
updated my query as below. |
|
|*PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX rdf:
<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX geo:
<http://www.opengis.net/ont/geosparql#> PREFIX xsd:
<http://www.w3.org/2001/XMLSchema#> PREFIX rdfs:
<http://www.w3.org/2000/01/rdf-schema#> PREFIX :
<http://example.org/#> PREFIX geo:
<http://www.opengis.net/ont/geosparql#> PREFIX spatial:
<http://jena.apache.org/spatial#> SELECT ?object WHERE { GRAPH
<http://project/base/default> { ?subject geo:asWKT ?object . ?object
geo:equals "POLYGON((8.463699817657472
48.99872928913063,8.463887572288515
48.998644821906865,8.46399486064911
48.998764483764916,8.46425771713257
48.99865538031766,8.464375734329225
48.998746886450874,8.463919758796694
48.99893693711346,8.463699817657472 48.99872928913063))" } } *|
|Which should result me atleast the coordinates of first geo object
which really equals the POLYGON coordinates but I get empty results as
shown in below image. Please suggest me where I am getting it wrong.**|
But I get no results as attached in snapshot. Please help me regarding
this.|


Reply via email to