- library
- semweb
- rdf_db.pl -- Core RDF database
- rdf_cache.pl -- Cache RDF triples
- rdfs.pl -- RDFS handling
- rdf11.pl -- RDF 1.1 API
- rdf/3
- rdf/4
- rdf_has/3
- rdf_has/4
- rdf_update/4
- rdf_update/5
- rdf_reachable/3
- rdf_reachable/5
- rdf_assert/3
- rdf_assert/4
- rdf_retractall/3
- rdf_retractall/4
- rdf_compare/3
- {}/1
- rdf_where/1
- rdf_default_graph/1
- rdf_default_graph/2
- rdf_canonical_literal/2
- rdf_lexical_form/2
- rdf_term/1
- rdf_literal/1
- rdf_bnode/1
- rdf_iri/1
- rdf_name/1
- rdf_subject/1
- rdf_predicate/1
- rdf_object/1
- rdf_node/1
- rdf_create_bnode/1
- rdf_is_iri/1
- rdf_is_bnode/1
- rdf_is_literal/1
- rdf_is_name/1
- rdf_is_object/1
- rdf_is_predicate/1
- rdf_is_subject/1
- rdf_is_term/1
- rdf_list/1
- rdf_list/2
- rdf_length/2
- rdf_member/2
- rdf_nextto/2
- rdf_nextto/3
- rdf_nth0/3
- rdf_nth1/3
- rdf_last/2
- rdf_estimate_complexity/4
- rdf_assert_list/2
- rdf_assert_list/3
- rdf_retract_list/1
- rdf_persistency.pl -- RDF persistency plugin
- rdf_litindex.pl -- Search literals
- rdf_ntriples.pl -- Process files in the RDF N-Triples format
- sparql_client.pl -- SPARQL client library
- turtle.pl -- Turtle: Terse RDF Triple Language
- rdf_turtle_write.pl -- Turtle - Terse RDF Triple Language writer
- rdf_http_plugin.pl -- RDF HTTP Plugin
- rdf_library.pl -- RDF Library Manager
- rdf_zlib_plugin.pl -- RDF compressed-data plugin
- semweb
- 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:
- Blank nodes are encoded by atoms that start with `_:`.
- IRIs appear in two notations:
- Full IRIs are encoded by atoms that do not start with `_:`. Specifically, an IRI term is not required to follow the IRI standard grammar.
- Abbreviated IRI notation that allows IRI prefix aliases
that are registered by rdf_register_prefix/[2,3] to be
used. Their notation is
Alias:Local
, where Alias and Local are atoms. Each abbreviated IRI is expanded by the system to a full IRI.
- Literals appear in two notations:
- @(String, Lang)
- A language-tagged string, where String is a Prolog string and Lang is an atom.
- ^^(Value, Type)
- A type qualified literal. For unknown types, Value is a
Prolog string. If type is known, the Prolog representations
from the table below are used.
Datatype IRI Prolog term xsd:float float xsd:double float xsd:decimal float (1) xsd:integer integer XSD integer sub-types integer xsd:boolean true
orfalse
xsd:date date(Y,M,D)
xsd:dateTime date_time(Y,M,D,HH,MM,SS)
(2,3)xsd:gDay integer xsd:gMonth integer xsd:gMonthDay month_day(M,D)
xsd:gYear integer xsd:gYearMonth year_month(Y,M)
xsd:time time(HH,MM,SS)
(2)
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
andfalse
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.