I found the following possible solution on stack overflow: 
https://stackoverflow.com/questions/21755157/sparql-graph-pattern-comparison

They suggest to turn both graph patterns into actual graphs and using regular 
graph isomorphism algorithms to judge their equality. Does Apache Jena already 
have such functionality?

-----Original Message-----
From: Nouwt, B. (Barry) <[email protected]> 
Sent: dinsdag 19 november 2019 12:17
To: [email protected]
Subject: ElementPathBlock comparison

Hi all,

I have two ARQ ElementPathBlocks (or Basic Graph Pattern, see SPARQL spec 
https://www.w3.org/TR/sparql11-query/#GraphPattern) and would like to know 
whether they are equal ignoring variable names and ordering of the triples. 
What is the best/easiest way to do that with the Apache Jena? I see there is an 
org.apache.jena.sparql.util.Iso class that provides methods for testing 
isomorphisms...but I'm unsure whether this is what I am looking for. I also 
tested two ElementPathBlocks and using their equalTo method (which uses the Iso 
class), but both variable names and order seems to matter judging them equal.

Any ideas?

Regards, Barry




This message may contain information that is not intended for you. If you are 
not the addressee or if this message was sent to you by mistake, you are 
requested to inform the sender and delete the message. TNO accepts no liability 
for the content of this e-mail, for the manner in which you use it and for 
damage of any kind resulting from the risks inherent to the electronic 
transmission of messages.

Reply via email to