Did you know ... Search Documentation:
rdf.pl -- RDF/XML parser
PublicShow source

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.

To be done
- The predicate load_rdf/2,3 is too easily confused with the semweb library predicate rdf_load/2,3 which uses process_rdf/3 to store the triples in the triple DB.
- It would be better to use library(intercept) do distinguish to have one predicate that can operate in both collecting and streaming modes.
Source load_rdf(+File, -Triples) is det
Source 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.
See also
- Use process_rdf/3 for processing large documents in call-back style.
Source xml_to_rdf(+XML, -Triples, +Options)
Source 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.

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 load_rdf(+File, -Triples) is det
Source 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.
See also
- Use process_rdf/3 for processing large documents in call-back style.