Hey Dave,
Thanks for this post, it helped me solve a bindings problem I was having where I was getting the dreaded “BADRDFVAL” deep inside my sparql endpoint. Playing around with your example I found out what was wrong with mine.
For what its worth, I was trying to return the target with the associated data. I had a BIND() that caused the bad rdf value.
I was using ?target as an object, and trying to bind it into the results.
BIND(?target as ?returnVar) # <– fails bad-val
What worked?
select ?trade ?trader ?ts …
?trade a ?tradeType;
xxx:tradeDate ?ts;
xxx:trader ?trader ; # binds up the trader for return
xxx:trader ?target . # member ship in our target’s bindings
This worked and avoided using sem.sparqlValues() which has an ugly syntax imho.
From what I can tell, there is no way to do this sort of thing directly in a SPARQL without having a VALUES statement. So this raises the question: Is ML invoking the SPARQL multiple times, once for each ?target array member creating a union of the results?
Please share any guesses or insights!
Cheers,
Derek
With MarkLogic’s SPARQL queries, we can bind a value to constrain the query. Using this capability, we can gather information...