SWI-Prolog Semantic Web Library

Abstract

The semweb library provides a Prolog library based on foreign-language extensions for storing and manipulating RDF triples. It can handle quite large sets of triples only limited by available memory. One million triples requires about 80MB memory, so a fully equiped 32-bit machine can handle about 25 million triples. A 64-bit machine with 32Gb memory (just a few thousand euros in june 2009) can handle up to 150 million triples.

Prerequisites

This library depends on the RDF parser library which in turn depends on the XML parser provided by the sgml package.

Further info

This library defines the semantic web infrastructure for SWI-Prolog. The library is documented in semweb.pdf or the equivalent semweb.html. If your installation does not include this file, please visit http://www.swi-prolog.org/packages/

Staying up-to-date

This library is under active development. The recent version can be accessed from the GIT repository under the directory pl/packages/semweb. See http://www.swi-prolog.org/git.html for details on the central GIT repository and instructions for browsing the repository online.

Prolog files

rdf11.pl  -- RDF 1.1 APIShow source
rdf/3True if an RDF triple <S,P,O> exists, optionally in the graph G.Source
rdf/4True if an RDF triple <S,P,O> exists, optionally in the graph G.Source
rdf_assert/3Assert a new triple.Source
rdf_assert/4Assert a new triple.Source
rdf_assert_list/2Create an RDF list from the given Prolog List.Source
rdf_assert_list/3Create an RDF list from the given Prolog List.Source
rdf_bnode/1True if BNode is a currently known blank node.Source
rdf_canonical_literal/2Transform a relaxed literal specification as allowed for rdf_assert/3 into its canonical form.Source
rdf_compare/3True if the RDF terms Left and Right are ordered according to the comparison operator Diff.Source
rdf_create_bnode/1Create a new BNode.Source
rdf_default_graph/1Query/set the notion of the default graph.Source
rdf_default_graph/2Query/set the notion of the default graph.Source
rdf_estimate_complexity/4Source
rdf_has/3Similar to rdf/3 and rdf/4, but P matches all predicates that are defined as an rdfs:subPropertyOf of P.Source
rdf_has/4Similar to rdf/3 and rdf/4, but P matches all predicates that are defined as an rdfs:subPropertyOf of P.Source
rdf_iri/1True if IRI is a current IRI.Source
rdf_is_bnode/1True if Term is an RDF blank node identifier.Source
rdf_is_iri/1True if IRI is an RDF IRI term.Source
rdf_is_literal/1True if Term is an RDF literal term.Source
rdf_is_name/1True if Term is an RDF Name, i.e., an IRI or literal.Source
rdf_is_object/1True if Term can appear in the object position of a triple.Source
rdf_is_predicate/1True if Term can appear in the predicate position of a triple.Source
rdf_is_subject/1True if Term can appear in the subject position of a triple.Source
rdf_is_term/1True if Term can be used as an RDF term, i.e., if Term is either an IRI, a blank node or an RDF literal.Source
rdf_last/2True when Last is the last element of RDFList.Source
rdf_length/2True when Length is the number of cells in RDFList.Source
rdf_lexical_form/2True when Lexical is the lexical form for the literal Literal.Source
rdf_list/1True if RDFTerm is a proper RDF list.Source
rdf_list/2True when PrologList represents the rdf:first objects for all cells in RDFList.Source
rdf_literal/1True if Term is a known literal.Source
rdf_member/2True when Member is a member of RDFList.Source
rdf_name/1True if Name is a current IRI or literal.Source
rdf_nextto/2True if Y directly follows X in RdfList.Source
rdf_nextto/3True if Y directly follows X in RdfList.Source
rdf_node/1True when T appears in the subject or object position of a known triple, i.e., is a node in the RDF graph.Source
rdf_nth0/3True when X is the Index-th element (0-based or 1-based) of RDFList.Source
rdf_nth1/3True when X is the Index-th element (0-based or 1-based) of RDFList.Source
rdf_object/1True when O is a currently known object, i.e.Source
rdf_predicate/1True when P is a currently known predicate, i.e.Source
rdf_reachable/3True when O can be reached from S using the transitive closure of P.Source
rdf_reachable/5True when O can be reached from S using the transitive closure of P.Source
rdf_retract_list/1Retract the rdf:first, rdf:rest and rdf:type=rdf:'List' triples from all nodes reachable through rdf:rest.Source
rdf_retractall/3Remove all matching triples from the database.Source
rdf_retractall/4Remove all matching triples from the database.Source
rdf_subject/1True when S is a currently known subject, i.e.Source
rdf_term/1True if Term appears in the RDF database.Source
rdf_update/4Replaces one of the three fields on the matching triples depending on Action:.Source
rdf_update/5Replaces one of the three fields on the matching triples depending on Action:.Source
rdf_where/1Formulate constraints on RDF terms, notably literals.Source
{}/1Formulate constraints on RDF terms, notably literals.Source
rdf_cache.pl  -- Cache RDF triplesShow source
rdf_db.pl  -- Core RDF databaseShow source
rdf_http_plugin.pl  -- RDF HTTP PluginShow source
rdf_open_hook/8Load hook implementation for HTTP(S) URLs.Source
rdf_content_type/3Quality values are intended to be used in accordance with RFC 2616.Source
rdf_library.pl  -- RDF Library ManagerShow source
rdf_litindex.pl  -- Search literalsShow source
rdf_delete_literal_index/1Fully delete a literal index.Source
rdf_find_literal/2Find literals in the RDF database matching Spec.Source
rdf_find_literals/2Find literals in the RDF database matching Spec.Source
rdf_literal_index/2True when Index is a literal map containing the index of Type.Source
rdf_set_literal_index_option/1Set options for the literal package.Source
rdf_stopgap_token/1True when Token is a stopgap token.Source
rdf_token_expansions/2Determine which extensions of a token contribute to finding literals.Source
rdf_tokenize_literal/2Tokenize a literal.Source
rdf_ntriples.pl  -- Process files in the RDF N-Triples formatShow source
rdf_persistency.pl  -- RDF persistency pluginShow source
rdf_portray.pl  -- Portray RDF resourcesShow source
rdf_sandbox.pl  -- Declare RDF API sandbox-safeShow source
rdf_turtle_write.pl  -- Turtle - Terse RDF Triple Language writerShow source
rdf_zlib_plugin.pl  -- RDF compressed-data pluginShow source
rdfs.pl  -- RDFS handlingShow source
rdfs_assert_list/2Create an RDF list from the given Resources.Source
rdfs_assert_list/3Create an RDF list from the given Resources.Source
rdfs_class_property/2Enumerate the properties in the domain of Class.Source
rdfs_find/5Search all classes below Domain for a literal property with that matches String.Source
rdfs_individual_of/2Generate resources belonging to a class or classes a resource belongs to.Source
rdfs_label/2Convert between class and label.Source
rdfs_label/3Resource has Label in Lang.Source
rdfs_list_to_prolog_list/2Convert ann RDFS list (result from parseType=Collection) into a Prolog list of elements.Source
rdfs_member/2As Prolog member on sets.Source
rdfs_ns_label/2Present label with namespace indication.Source
rdfs_ns_label/3Present label with namespace indication.Source
rdfs_subclass_of/2Generate sub/super classes.Source
rdfs_subproperty_of/2Query the property hierarchy.Source
sparql_client.pl  -- SPARQL client libraryShow source
sparql_query/3Execute a SPARQL query on an HTTP SPARQL endpoint.Source
sparql_read_json_result/2The returned Result term is of the format:.Source
sparql_read_xml_result/2Specs from http://www.w3.org/TR/rdf-sparql-XMLres/.Source
sparql_set_server/1Set sparql server default options.Source
turtle.pl  -- Turtle: Terse RDF Triple LanguageShow source