This module writes an RDF/XML document from a list of triples of the
rdf(Subject, Predicate, Object). It is primarily intended for
communicating computed RDF model fragments to external programs using
When used from the HTTP library, use the following code:
reply_graph(RDF) :- format('Content-type: application/rdf+xml; charset=UTF-8~n~n'), rdf_write_xml(current_output, RDF).
- rdf_write_xml(+Out:stream, +Triples:list(rdf(S,P,O))) is det
- Write an RDF/XML serialization of Triples to Out.
- rdf_write_header(+Out, +Triples)[private]
- Save XML document header, doctype and open the RDF environment. This predicate also sets up the namespace notation.
- xml_escape_parameter_entity(+In, -Out) is det[private]
- Escape % as % for entity declarations.
- used_namespaces(+Triples:list(rdf(S,P,O)), -List:atom) is det[private]
- Return the list of namespace abbreviations used in a set of triples.
- resources(+Triples:list(rdf(S,P,O)), -Resources:list(atom)) is det[private]
- Resources is the set of resources referenced in Triples.
- For every URL used as a predicate we MUST define a namespace as we cannot use names holding /, :, etc. as XML identifiers.
- node_id_map(+Triples, -IdMap) is det[private]
- Create an assoc Resource -> NodeID for those anonymous resources in Triples that need a NodeID. This implies all anonymous resources that are used multiple times as object value.
- save_attributes(+List, +DefNS, +Out, +NodeIDs, Element, +Indent, +Anon)[private]
- Save the attributes. Short literal attributes are saved in the tag. Others as the content of the description element. The begin tag has already been filled.
- save_attribute(+Where, +Triple, +DefNS, +Out, +NodeIDs, +Indent, +Anon)[private]
- rdf_p_id(+Resource, +DefNS, -NSLocal)[private]
- As rdf_id/3 for predicate names. Maps _:<N> to rdf:li.
- is_bag_li_predicate(+Pred) is semidet[private]
- True if Pred is _:N, as used for members of an rdf:Bag, rdf:Seq or rdf:Alt.
- rdf_id(+Resource, +DefNS, -NSLocal)[private]
- Generate a NS:Local name for Resource given the indicated default namespace. This call is used for elements.
- rdf_write_id(+Out, +NSLocal) is det[private]
- Write an identifier. We cannot use native write on it as both NS and Local can be operators.
- rdf_att_id(+URI, +DefNS, -ID)[private]
- rdf_value(+Resource, -Text, +Encoding)[private]
- According to "6.4 RDF URI References" of the RDF Syntax
specification, a URI reference is UNICODE string not containing
control sequences, represented as UTF-8 and then as escaped
NOTE: the to_be_described/1 trick ensures entity rewrite in resources that start with 'http://t-d-b.org?'. This is a of a hack to save the artchive data in the MultimediaN project. We should use a more general mechanism.