rdf(?S, ?P, ?O) is nondet
 rdf(?S, ?P, ?O, ?G) is nondet
True if an RDF triple <S,P,O> exists, optionally in the graph G. The object O is either a resource (atom) or one of the terms listed below. The described types apply for the case where O is unbound. If O is instantiated it is converted according to the rules described with rdf_assert/3.

Triples consist of the following three terms:

Notes:

(1) The current implementation of xsd:decimal values as floats is formally incorrect. Future versions of SWI-Prolog may introduce decimal as a subtype of rational.

(2) SS fields denote the number of seconds. This can either be an integer or a float.

(3) The date_time structure can have a 7th field that denotes the timezone offset in seconds as an integer.

In addition, a ground object value is translated into a properly typed RDF literal using rdf_canonical_literal/2.

There is a fine distinction in how duplicate statements are handled in rdf/[3,4]: backtracking over rdf/3 will never return duplicate triples that appear in multiple graphs. rdf/4 will return such duplicate triples, because their graph term differs.

Arguments:
S- is the subject term. It is either a blank node or IRI.
P- is the predicate term. It is always an IRI.
O- is the object term. It is either a literal, a blank node or IRI (except for true and false that denote the values of datatype XSD boolean).
G- is the graph term. It is always an IRI.
See also
- Triple pattern querying
- xsd_number_string/2 and xsd_time_string/3 are used to convert between lexical representations and Prolog terms.