Hi, comments inline

On 24.03.23 18:30, Yang-Min KIM wrote:
Dear Jena community,

I would like to use GeoSPARQL, but before I proceed I need your valuable advice.

What I want to do:
- Using GeoSPARQL, nodes have their own position (or zone).
In RDF and thus in Jena those are still plain RDF nodes in the RDF graph, doesn't matter if those nodes have geospatial information assigned or not
- Graph is weighted: edge has a value
Are you talking about edges aka triples in the RDF graph? The weight is an RDF triple then? Or an annotation on the RDF triple itself? Or an RDF Star triple?
- Find the shortest path between nodes in a weighted graph

How? Writing your own custom algorithm traversing the RDF graph? Neither SPARQL as the dedicated query language for RDF not RDF itself have algorithms or concepts of paths.

On the other hand, some triple stores nowadays provide extension to traverse the graph more efficiently, but there is no standardized method. For example, even Jena has some Java code do compute the/some shortest path: https://jena.apache.org/documentation/javadoc/jena/org.apache.jena.core/org/apache/jena/ontology/OntTools.html#findShortestPath(org.apache.jena.rdf.model.Model,org.apache.jena.rdf.model.Resource,org.apache.jena.rdf.model.RDFNode,java.util.function.Predicate)

But this implementation is no weighted, so you would have to extend the code or just write your own custom Java code based on Jena's Graph::find method for example. Even more simple, use JGraphT and just write a wrapper for Jena - we did the same, so we could apply JGraphT algorithms on a Jena Graph object. Indeed, efficiency can't be the same as for other Graph databases with optimized index structures.


My question is, what is the relation to GeoSPARQL in your current problem? Does it matter for your weighted graph? Can you give an example fore the RDF graph?


For instance, there is Dijkstra's algorithm allowing to find the shortest paths considering weighted edges.
<https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm>

Here are my questions as a beginner:
1. What is the best way to integrate a weighted graph in Jena?
2. Maybe RDF* (RDF-star)? Is it compatible with GeoSPARQL?
3. How can we find a shortest path considering edge values?

Thank you for your time and have a great weekend.

Min


Reply via email to