'How to get all related triples to a subject in SPARQL?

I would need to get all data related to a subject. I tried to query for

SELECT * WHERE {?s ?p ?o}

But the problem is that some of the ?o objects are URIs and I also need those connections, until the connections end. For example, I have:

http://www.example.com/data/subject-test http://www.example.com#hasNetListPrice http://www.example.com/data/price-subject-test.


http://www.example.com/data/price-subject-test http://www.example.com/si-cpq/data/price-currency http://www.example.com/data/EURO.

And so on, until the triples are no longer connected to the initial subject, http://www.example.com/si-cpq/data/subject-test.

Also, there are sometimes 4 triples connected, sometimes more, so I could not use the same pattern for all. Also, would need a general select query, not one that works only for the price triples, because the data has more attributes.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source