SWRL or SPARQL Function

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

SWRL or SPARQL Function

Rimel
Hello,

I want to execute an SWRL or SPARQL function to retrieve the nearest
location for a given one.

Have you any idea to do that, please

Thanks in advance



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: SWRL or SPARQL Function

Igor Toujilov-2
In a simple scenario when you have a set of possible locations, a special location, and you want to find the nearest location from the special location, this task is equivalent to finding a minimal distance from the special location to the nearest location. As min is an aggregation function, you can use usual aggregation techniques.

In SPARQL, use the corresponding built-in minimisation function on the resulting set of distances. (I am not an expert in SPARQL, but people might provide more details on how the query can look like.)

In SWRL, you will need to construct what I call a "partial closure of the world" on the set of locations. This is the usual technique to deal with aggregation functions in OWL. For example, you can organise the locations in a linked list. And then apply SWRL comparison built-ins to minimise the distance.

Cheers,
Igor

> Sent: Wednesday, July 10, 2019 at 11:46 PM
> From: "Rimel" <[hidden email]>
> To: [hidden email]
> Subject: [protege-user] SWRL or SPARQL Function
>
> Hello,
>
> I want to execute an SWRL or SPARQL function to retrieve the nearest
> location for a given one.
>
> Have you any idea to do that, please
>
> Thanks in advance
>
>
>
> --
> Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user
>
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: SWRL or SPARQL Function

Lorenz Buehmann
It's not that simple. You would need also some Geo distance function which also means you need geo coordinates in your data. Something like WGS 84 or WKT fo r example are state-of-the-art here.

And for SPARQL, we usually use GeoSPARQL + an engine that does support GeoSPARQL as well as (ideally) Geo indexing for performance. Neither SWRL nor the Protege SPARQL plugin do support this currently - as far as I know. The SPARQL layer is still on Sesame and there is a PR for RDF4J which does support GeoSPARQL an top of WKT data format.

But as I said, things start at the creation of the data, please use a common format here.

In a simple scenario when you have a set of possible locations, a special location, and you want to find the nearest location from the special location, this task is equivalent to finding a minimal distance from the special location to the nearest location. As min is an aggregation function, you can use usual aggregation techniques.

In SPARQL, use the corresponding built-in minimisation function on the resulting set of distances. (I am not an expert in SPARQL, but people might provide more details on how the query can look like.)

In SWRL, you will need to construct what I call a "partial closure of the world" on the set of locations. This is the usual technique to deal with aggregation functions in OWL. For example, you can organise the locations in a linked list. And then apply SWRL comparison built-ins to minimise the distance.

Cheers,
Igor

Sent: Wednesday, July 10, 2019 at 11:46 PM
From: "Rimel" [hidden email]
To: [hidden email]
Subject: [protege-user] SWRL or SPARQL Function

Hello,

I want to execute an SWRL or SPARQL function to retrieve the nearest
location for a given one.

Have you any idea to do that, please

Thanks in advance



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

-- 
Lorenz B├╝hmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user