
rdf_prefixes.pl -- RDF prefixes management
This module defines the expansion of Prefix:Local terms to full IRIs.
This library is typically not intended for the end-user. It may be
included into other RDF and XML libraries and relevant parts may be
re-exported.
rdf_empty_prefix_cache(+Alias, +URI)[multifile]
rdf_current_prefix(:Alias, ?URI) is nondetrdf_current_prefix(Prefix, Expansion), atom_concat(Expansion, Local, URI),
rdf_prefix(:Alias, +URI) is det
rdf_db:ns(?Alias, ?URI) is nondet[multifile]
rdf_register_prefix(+Prefix, +URI) is det
rdf_register_prefix(+Prefix, +URI, +Options) is dettrue, 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.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:
rdf_unregister_prefix(+Alias) is det
rdf_current_ns(:Prefix, ?URI) is nondet
rdf_register_ns(:Prefix, ?URI) is det
rdf_register_ns(:Prefix, ?URI, +Options) is det
register_file_prefixes(+Map:list(pair)) is det
rdf_global_id(?IRISpec, :IRI) is semidetNote 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 (?,?).
rdf_global_object(+Object, :GlobalObject) is semidet
rdf_global_term(+TermIn, :GlobalTerm) is det
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.
rdf_meta(+Heads)
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.