Hi. Thanks for the quick answer on the other post.
The second problem I’m experiencing, which I don’t know how to resolve is how to use the expand option in rdf_save_turtle. Reading the docs, it seems obvious to me that it can be used to select different tuples than the default ones, so it may be used to create a filter based on Subject and Predicate.
rdf_save_turtle(StreamResponse, [
expand(query_filter(Subject, Predicate))
]).
query_filter(Subject, Predicate, S, P, O, _G) :-
Subject = S,
Predicate = P,
rdf(S, P, O).
However, when O is a literal, there’s a type error:
Type error: `rdf_literal' expected, found `^^("Blablabla",'http://www.w3.org/2001/XMLSchema#string')' (a compound)
When O is also an URI I don’t have problems, and the code filters as expected.
But I thought ^^(str, type) was a representation of a literal so I don’t know which is the problem.
My tuples are loaded like this in other place, that might be the problem:
rdf_read_turtle(atom(Input), Triples, []),
forall(member(Triple, Triples), (
Triple = rdf(S, P, O),
rdf_assert(S, P, O)
)),
TLDR; I want do a filter of triples that get saved in the Turtle output, but it fails when encounters a literal.
Thanks in advance