I hope this email finds you well. I'm writing to seek your assistance regarding a programming task I'm working on, specifically related to traversing nested triple patterns in SPARQL-star queries using the Apache Jena framework. Recently, I executed a code snippet that retrieves the query pattern from a SPARQL query using the Apache Jena library. The code checks if the query pattern is a group (represented by the ElementGroup class) and, if so, retrieves the individual elements of the group. For each element, it prints a string representation of the element using the toString() method.

However, when I ran the code, the output I received was in the format:

Element: << ?s ex:p1 ex:o1 >> ex:p2 ?o.

But this provides a partial view of the nested triple patterns, which does not meet my requirements. I am particularly interested in obtaining every individual triple or triple pattern within each level of nesting. Unfortunately, the output includes incomplete elements, such as |ex:p2 ?o|, which fails to capture the complete nested triple pattern.

I recognized that I need to use SPARQL-Star parser but in the github of Apache jena, I can only find the SPARQL parser and not the SPARQL-Star parser.

I would appreciate any help.

Thank you in advance

Kind Regards

Reply via email to