PublicShow sourcerdf_db.pl

Re-exported predicates

The following predicates are exported from this file while their implementation is defined in imported modules or non-module files loaded by this module.

Source rdf_current_prefix(:Alias, ?URI) is nondet
Query predefined prefixes and prefixes defined with rdf_register_prefix/2 and local prefixes defined with rdf_prefix/2. If Alias is unbound and one URI is the prefix of another, the longest is returned first. This allows turning a resource into a prefix/local couple using the simple enumeration below. See rdf_global_id/2.
rdf_current_prefix(Prefix, Expansion),
atom_concat(Expansion, Local, URI),
Source rdf_prefix(:Alias, +URI) is det
Register a local prefix. This declaration takes precedence over globally defined prefixes using rdf_register_prefix/2,3. Module local prefixes are notably required to deal with SWISH, where users need to be able to have independent namespace declarations.
Source rdf_register_prefix(+Prefix, +URI) is det
Source rdf_register_prefix(+Prefix, +URI, +Options) is det
Register Prefix as an abbreviation for URI. Options:
force(Boolean)
If true, replace existing namespace alias. Please note that replacing a namespace is dangerous as namespaces affect preprocessing. Make sure all code that depends on a namespace is compiled after changing the registration.
keep(Boolean)
If true and Alias is already defined, keep the original binding for Prefix and succeed silently.

Without options, an attempt to redefine an alias raises a permission error.

Predefined prefixes are:

AliasIRI prefix
dchttp://purl.org/dc/elements/1.1/
dctermshttp://purl.org/dc/terms/
eorhttp://dublincore.org/2000/03/13/eor#
foafhttp://xmlns.com/foaf/0.1/
owlhttp://www.w3.org/2002/07/owl#
rdfhttp://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfshttp://www.w3.org/2000/01/rdf-schema#
serqlhttp://www.openrdf.org/schema/serql#
skoshttp://www.w3.org/2004/02/skos/core#
voidhttp://rdfs.org/ns/void#
xsdhttp://www.w3.org/2001/XMLSchema#
Source rdf_register_prefix(+Prefix, +URI) is det
Source rdf_register_prefix(+Prefix, +URI, +Options) is det
Register Prefix as an abbreviation for URI. Options:
force(Boolean)
If true, replace existing namespace alias. Please note that replacing a namespace is dangerous as namespaces affect preprocessing. Make sure all code that depends on a namespace is compiled after changing the registration.
keep(Boolean)
If true and Alias is already defined, keep the original binding for Prefix and succeed silently.

Without options, an attempt to redefine an alias raises a permission error.

Predefined prefixes are:

AliasIRI prefix
dchttp://purl.org/dc/elements/1.1/
dctermshttp://purl.org/dc/terms/
eorhttp://dublincore.org/2000/03/13/eor#
foafhttp://xmlns.com/foaf/0.1/
owlhttp://www.w3.org/2002/07/owl#
rdfhttp://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfshttp://www.w3.org/2000/01/rdf-schema#
serqlhttp://www.openrdf.org/schema/serql#
skoshttp://www.w3.org/2004/02/skos/core#
voidhttp://rdfs.org/ns/void#
xsdhttp://www.w3.org/2001/XMLSchema#
Source rdf_unregister_prefix(+Alias) is det
Delete a prefix global registration.
Source rdf_current_ns(:Prefix, ?URI) is nondet
deprecated
- Use rdf_current_prefix/2.
Source rdf_register_ns(:Prefix, ?URI) is det
Source rdf_register_ns(:Prefix, ?URI, +Options) is det
Register an RDF prefix.
deprecated
- Use rdf_register_prefix/2 or rdf_register_prefix/3.
Source rdf_register_ns(:Prefix, ?URI) is det
Source rdf_register_ns(:Prefix, ?URI, +Options) is det
Register an RDF prefix.
deprecated
- Use rdf_register_prefix/2 or rdf_register_prefix/3.
Source rdf_global_id(?IRISpec, :IRI) is semidet
Convert between Prefix:Local and full IRI (an atom). If IRISpec is an atom, it is simply unified with IRI. This predicate fails silently if IRI is an RDF literal.

Note that this predicate is a meta-predicate on its output argument. This is necessary to get the module context while the first argument may be of the form (:)/2. The above mode description is correct, but should be interpreted as (?,?).

Errors
- existence_error(rdf_prefix, Prefix)
See also
- rdf_equal/2 provides a compile time alternative
- The rdf_meta/1 directive asks for compile time expansion of arguments.
bug
- Error handling is incomplete. In its current implementation the same code is used for compile-time expansion and to facilitate runtime conversion and checking. These use cases have different requirements.
Source rdf_global_object(+Object, :GlobalObject) is semidet
rdf_global_object(-Object, :GlobalObject) is semidet
Same as rdf_global_id/2, but intended for dealing with the object part of a triple, in particular the type for typed literals. Note that the predicate is a meta-predicate on the output argument. This is necessary to get the module context while the first argument may be of the form (:)/2.
Errors
- existence_error(rdf_prefix, Prefix)
Source rdf_global_term(+TermIn, :GlobalTerm) is det
Performs rdf_global_id/2 on prefixed IRIs and rdf_global_object/2 on RDF literals, by recursively analysing the term. Note that the predicate is a meta-predicate on the output argument. This is necessary to get the module context while the first argument may be of the form (:)/2.

Terms of the form Prefix:Local that appear in TermIn for which Prefix is not defined are not replaced. Unlike rdf_global_id/2 and rdf_global_object/2, no error is raised.

Source rdf_meta(+Heads)
This directive defines the argument types of the named predicates, which will force compile time namespace expansion for these predicates. Heads is a coma-separated list of callable terms. Defined argument properties are:
:
Argument is a goal. The goal is processed using expand_goal/2, recursively applying goal transformation on the argument.
+
The argument is instantiated at entry. Nothing is changed.
-
The argument is not instantiated at entry. Nothing is changed.
?
The argument is unbound or instantiated at entry. Nothing is changed.
@
The argument is not changed.
r
The argument must be a resource. If it is a term prefix:local it is translated.
o
The argument is an object or resource. See rdf_global_object/2.
t
The argument is a term that must be translated. Expansion will translate all occurrences of prefix:local appearing anywhere in the term. See rdf_global_term/2.

As it is subject to term_expansion/2, the rdf_meta/1 declaration can only be used as a directive. The directive must be processed before the definition of the predicates as well as before compiling code that uses the rdf meta-predicates. The atom rdf_meta is declared as an operator exported from library(semweb/rdf_db). Files using rdf_meta/1 must explicitly load this library.

Beginning with SWI-Prolog 7.3.17, the low-level RDF interface (rdf/3, rdf_assert/3, etc.) perform runtime expansion of Prefix:Local terms. This eliminates the need for rdf_meta/1 for simple cases. However, runtime expansion comes at a significant overhead and having two representations for IRIs (a plain atom and a term Prefix:Local) implies that simple operations such as comparison of IRIs no longer map to native Prolog operations such as IRI1 == IRI2.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

Source rdf_delete_snapshot(Arg1)
Source rdf_current_literal(Arg1)
Source rdf_insert_literal_map(Arg1, Arg2, Arg3, Arg4)
Source rdf_load(Arg1)
Source rdf_split_url(Arg1, Arg2, Arg3)
Source rdf_update(Arg1, Arg2, Arg3, Arg4)
Source rdf_save(Arg1)
Source rdf_delete_literal_map(Arg1, Arg2, Arg3)
Source rdf(Arg1, Arg2, Arg3)
Source rdf_member_property(Arg1, Arg2)
Source rdf_transaction(Arg1)
Source rdf_has(Arg1, Arg2, Arg3, Arg4)
Source rdf_snapshot(Arg1)
Source rdf_update(Arg1, Arg2, Arg3, Arg4, Arg5)
Source rdf_set_predicate(Arg1, Arg2)
Source rdf_url_namespace(Arg1, Arg2)
Source rdf_reset_literal_map(Arg1)
Source rdf_new_literal_map(Arg1)
Source rdf_save_subject(Arg1, Arg2, Arg3)
Source rdf_make
Source rdf_graph_prefixes(Arg1, Arg2)
Source rdf_generation(Arg1)
Source rdf_monitor(Arg1, Arg2)
Source rdf_save_db(Arg1)
Source rdf_warm_indexes
Source rdf_atom_md5(Arg1, Arg2, Arg3)
Source rdf_unload_graph(Arg1)
Source rdf_graph(Arg1)
Source rdf_compare(Arg1, Arg2, Arg3)
Source rdf_statistics_literal_map(Arg1, Arg2)
Source rdf_current_snapshot(Arg1)
Source rdf_save_footer(Arg1)
Source rdf_warm_indexes(Arg1)
Source rdf_active_transaction(Arg1)
Source rdf_is_resource(Arg1)
Source rdf_retractall(Arg1, Arg2, Arg3)
Source rdf_md5(Arg1, Arg2)
Source rdf_create_graph(Arg1)
Source rdf_assert(Arg1, Arg2, Arg3, Arg4)
Source rdf_transaction(Arg1, Arg2)
Source rdf_bnode(Arg1)
Source rdf_estimate_complexity(Arg1, Arg2, Arg3, Arg4)
Source rdf_source(Arg1)
Source rdf_node(Arg1)
Source rdf_set(Arg1)
Source lang_equal(Arg1, Arg2)
Source rdf_load_db(Arg1)
Source rdf_is_bnode(Arg1)
Source rdf_insert_literal_map(Arg1, Arg2, Arg3)
Source rdf_destroy_literal_map(Arg1)
Source rdf_assert(Arg1, Arg2, Arg3)
Source rdf_find_literal_map(Arg1, Arg2, Arg3)
Source rdf_statistics(Arg1)
Source rdf_save(Arg1, Arg2)
Source rdf_graph_property(Arg1, Arg2)
Source rdf_gc
Source rdf_save_db(Arg1, Arg2)
Source lang_matches(Arg1, Arg2)
Source rdf_literal_value(Arg1, Arg2)
Source rdf(Arg1, Arg2, Arg3, Arg4)
Source rdf_debug(Arg1)
Source rdf_subject(Arg1)
Source rdf_delete_literal_map(Arg1, Arg2)
Source rdf_keys_in_literal_map(Arg1, Arg2, Arg3)
Source rdf_source_location(Arg1, Arg2)
Source rdf_load(Arg1, Arg2)
Source rdf_is_literal(Arg1)
Source rdf_predicate_property(Arg1, Arg2)
Source rdf_save_header(Arg1, Arg2)
Source rdf_resource(Arg1)
Source rdf_update_duplicates
Source rdf_version(Arg1)
Source rdf_equal(Arg1, Arg2)
Source rdf_source(Arg1, Arg2)
Source rdf_reachable(Arg1, Arg2, Arg3)
Source rdf_transaction(Arg1, Arg2, Arg3)
Source rdf_current_predicate(Arg1)
Source rdf_has(Arg1, Arg2, Arg3)
Source rdf_match_label(Arg1, Arg2, Arg3)
Source rdf_graph_prefixes(Arg1, Arg2, Arg3)
Source rdf_retractall(Arg1, Arg2, Arg3, Arg4)
Source rdf_reachable(Arg1, Arg2, Arg3, Arg4, Arg5)
Source rdf_reset_db
Source rdf_set_graph(Arg1, Arg2)
Source rdf_unload(Arg1)