rdf.pl -- RDF/XML parser
This module parses RDF/XML documents. It defines two processing modes:
load_rdf/2 and load_rdf/3 which process a document into a list of
rdf(S,P,O)
terms and process_rdf/3 which processes the input
description-by-description and uses a callback to handle the triples.
- load_rdf(+File, -Triples) is det
- load_rdf(+File, -Triples, :Options) is det
- Parse an XML file holding an RDF term into a list of RDF triples.
see rdf_triple.pl for a definition of the output format. Options:
- base_uri(+URI)
- URI to use as base
- expand_foreach(+Bool)
- Apply
each(Container, Pred, Object)
on the members of Container - namespaces(-Namespaces:list(NS=URL))
- Return list of namespaces declared using xmlns:NS=URL in the document. This can be used to update the namespace list with rdf_register_ns/2.
- xml_to_rdf(+XML, -Triples, +Options)
- process_rdf(+Input, :OnObject, :Options)
- Process RDF from Input. Input is either an atom or a term of the
format
stream(Handle)
. For each encountered description, call OnObject(+Triples) to handle the triples resulting from the description. Defined Options are:- base_uri(+URI)
- Determines the reference URI.
- db(DB)
- When loading from a stream, the source is taken from this option or -if non-existent- from base_uri.
- lang(LanguageID)
- Set initial language (as xml:lang)
- convert_typed_literal(:Convertor)
- Call Convertor(+Type, +Content, -RDFObject) to create
a triple
rdf(S, P, RDFObject)
instead of rdf(S, P,literal(type(Type, Content))
. - namespaces(-Namespaces:list(NS=URL))
- Return list of namespaces declared using xmlns:NS=URL in the document. This can be used to update the namespace list with rdf_register_ns/2.
- entity(Name, Value)
- Overrule entity values found in the file
- embedded(Boolean)
- If
true
, do not give warnings if rdf:RDF is embedded in other XML data.
- on_xmlns(+NS, +URL, +Parser)[private]
- Build up the list of encountered xmlns:NS=URL declarations. We use destructive assignment here as an alternative to assert/retract, ensuring thread-safety and better performance.
Undocumented predicates
The following predicates are exported, but not or incorrectly documented.