How to convert this simple query to Jena java query builder?
SELECT ?city
WHERE { <<:athens :connected ?city >> :distance 500}
I tried this in Clojure and it didn't work.
No need to write Clojure i just need the Java code.
I created a TipleNode and gave it as subject to a a Triple that i added to Where, but it complains about the subject.
Error :
Caused by: java.lang.IllegalArgumentException: Subject (<< https://squery.org/joy/athens @https://squery.org/joy/connected ?city >>)
must be a URI, blank, variable, or a wildcard.
Is a prefix missing? Prefix must be defined before use.
(->
(SelectBuilder.)
(.addVar "?city")
(.addWhere
(Triple/create
(NodeFactory/createTripleNode
(.asNode (ResourceFactory/createResource "https://squery.org/joy/athens"))
(.asNode (ResourceFactory/createProperty "https://squery.org/joy/connected"))
(.asNode (Var/alloc "city")))
(.asNode (ResourceFactory/createProperty "https://squery.org/joy/distance"))
(.asNode (ResourceFactory/createTypedLiteral 500))))
.build
.toString
println)