• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

3.3 Low-level access
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog RDF parser
        • Predicates for parsing RDF/XML
          • Low-level access
            • xml_to_rdf/3
            • process_rdf/3
Availability::- use_module(library(rdf)).(can be autoloaded)
Sourceprocess_rdf(+Input, :OnTriples, +Options)

Exploits the call-back interface of sgml2pl, calling OnTriples(Triples, File:Line) with the list of triples resulting from a single top level RDF object for each RDF element in the input as well as the source-location where the description started. Input is either a file name or term stream(Stream). When using a stream all triples are associated to the value of the base_uri option. This predicate can be used to process arbitrary large RDF files as the file is processed object-by-object. The example below simply asserts all triples into the database:

assert_list([], _).
assert_list([H|T], Source) :-
        assert(H),
        assert_list(T, Source).

?- process_rdf('structure,rdf', assert_list, []).

Options are described with load_rdf/3. The option expand_foreach is not supported as the container may be in a different description. Additional it provides embedded:

embedded(Boolean)
The predicate process_rdf/3 processes arbitrary XML documents, only interpreting the content of rdf:RDF elements. If this option is false (default), it gives a warning on elements that are not processed. The option embedded(true) can be used to process RDF embedded in xhtml without warnings.

ClioPatria (version V3.1.1-51-ga0b30a5)