rdf_library.pl -- RDF Library Manager
This module manages an ontology library. Such a library consists of a
directory with manifest files named Manifest.rdf
or Manifest.ttl
(Turtle). The manifest files define ontologies appearing in the library
as well as namespace mnemonics and dependencies.
The typical usage scenario is
?- rdf_attach_library('/some/directory'). ?- rdf_load_library(my_ontology).
- rdf_load_library(+Id) is det
- rdf_load_library(+Id, +Options) is det
- Load ontologies from the library. A library must first be
attached using rdf_attach_library/1. Defined Options are:
- import(Bool)
- If
true
(default), also load ontologies that are explicitely imported. - base_uri(URI)
- BaseURI used for loading RDF. Local definitions in ontologies overrule this option.
- claimed_source(URL)
- URL from which we claim to have loaded the data.
- not_found(+Level)
- The system does a pre-check for the existence of
all references RDF databases. If Level is
error
it reports missing databases as an error and fails. Ifwarning
it prints them, but continues. Ifsilent
, no checks are preformed. Default iserror
. - concurrent(Threads)
- Perform the load concurrently using N threads. If not specified, the number is determined by guess_concurrency/2.
- load(+Bool)
- If
false
, to all the preparation, but do not execute the actual loading. See also rdf_list_library/2.
- rdf_library_source(+Id, -Source) is nondet
- True of Source is the URL that is part of the given library Id. This predicate finds all indirect dependencies. It does not check whether the source exists or is valid.
- find_conflicts(+LoadCommands) is semidet[private]
- Find possibly conflicting options for loading the same source
- no_source_with_different_options(+Commands) is semidet[private]
- True if there are not multiple calls to load the same graph, but with different load-options. Prints a warning and fails otherwise.
- no_sources_in_same_graph(+Commands) is semidet[private]
- True if there are not two load commands referring to the same graph.
- check_existence(+CommandsIn, -Commands, +Options) is det[private]
- Report existence errors. Fail if at least one source does not
exist. and the not_found level is not
silent
. - guess_concurrency(+Commands, -Threads) is det[private]
- How much concurrency to use? Set to the number of CPUs if all input comes from files or 5 if network based loading is demanded.
- load_commands(+Id, +Options, -Pairs:list(Level-Command)) is det[private]
- Commands are the RDF commands to execute for rdf_load_library/2. Splitting in command collection and execution allows for concurrent execution as well as forward checking of possible problems.
- import(+URL, +Level, +Options) is det[private]
- rdf_list_library(+Id) is det
- rdf_list_library(+Id, +Options) is det
- Print library dependency tree to the terminal. Options include
options for rdf_load_library/2 and
- show_source(+Boolean)
- If
true
(default), show location we are loading - show_graph(+Boolean)
- If
true
(defaultfalse
), show name of graph - show_virtual(+Boolean)
- If
false
(defaulttrue
), do not show virtual repositories. - indent(Atom)
- Atom repeated for indentation levels
- rdf_list_library
- Prints known RDF library identifiers to current output.
- rdf_library_index(?Id, ?Facet) is nondet
- Query the content of the library. Defined facets are:
- source(URL)
- Location from which to load the ontology
- title(Atom)
- Title used for the ontology
- comment(Atom)
- Additional comments for the ontology
- version(Atom)
- Version information on the ontology
- imports(Type, URL)
- URLs needed by this ontology. May succeed multiple
times. Type is one of
ontology
,schema
orinstances
. - base_uri(BaseURI)
- Base URI to use when loading documents. If BaseURI
ends in
/
, the actual filename is attached. - claimed_source(Source)
- URL from which we claim to have loaded the RDF. If
Source ends in
/
, the actual filename is attached. - blank_nodes(Share)
- Defines how equivalent blank nodes are handled, where
Share is one of
share
ornoshare
. Default is to share. - format(Format)
- Format of the resource. Can be used to overrule if the format as derived from the HTTP content type is wrong.
- provides_ns(URL)
- Ontology provides definitions in the namespace URL. The formal definition of this is troublesome, but in practice it means the ontology has triples whose subjects are in the given namespace.
- uses_ns(URL)
- The ontology depends on the given namespace. Normally means it contains triples that have predicates or objects in the given namespace.
- manifest(URL)
- URL of the manifest in which this ontology is defined.
- virtual
- Entry is virtual (cannot be loaded)
- rdf_attach_library(+Source)
- Attach manifest from Source. Source is one of
- URL
- Load single manifest from this URL
- File
- Load single manifest from this file
- Directory
- Scan all subdirectories and load all
Manifest.ttl
orManifest.rdf
found. If Directory is a path-alias (e.g.,ontology(.)
), all referenced directories are scanned for manifest files.
Encountered namespaces are registered using rdf_register_ns/2. Encountered ontologies are added to the index. If a manifest was already loaded it will be reloaded if the modification time has changed.
- rdf_update_library_index[private]
- Reload all Manifest files.
- process_manifest(+Location) is det[private]
- Process a manifest file, registering encountered namespaces and creating clauses for library/3. No op if manifest was loaded and not changed. Removes old data if the manifest was changed.
- extract_namespace(+Triples, -Mnemonic, -NameSpace)[private]
- True if Mnemonic is an abbreviation of NameSpace.
- extract_ontology(+Triples, -Ontology) is nondet[private]
- Extract definition of an ontology
- facet(+Triples, +File, -Facet) is nondet[private]
- Enumerate facets about File from Triples. Facets are described with rdf_library_index/2.
- edge(+Triples, ?S, ?P, ?O) is nondet[private]
- Like rdf_has/3 over a list of Triples.
- source_time(+Source, -Modified) is semidet[private]
- Modified is the last modification time of Source.
- read_triples(+URL, -Triples) is det[private]
- Read RDF/XML or Turtle file into a list of triples.
- assert_ontology(+Manifest, +Term:library(Name,File,Facets)) is det[private]
- Add ontology to our library.
- library(?Id, ?URL, ?Facets)[private]
- Access DB for library information.
- normalize_url(+URL, -Normalized)[private]
- Like uri_normalized/2, but we also need (platform dependent) filename canonization.
- define_namespace(NS:ns(Mnemonic,Namespace)) is det[private]
- Add namespace declaration for Mnemonic.
- rdf_current_manifest(-URL) is nondet
- True if URL is the URL of a currently loaded manifest file.
- rdf_load_library(+Id) is det
- rdf_load_library(+Id, +Options) is det
- Load ontologies from the library. A library must first be
attached using rdf_attach_library/1. Defined Options are:
- import(Bool)
- If
true
(default), also load ontologies that are explicitely imported. - base_uri(URI)
- BaseURI used for loading RDF. Local definitions in ontologies overrule this option.
- claimed_source(URL)
- URL from which we claim to have loaded the data.
- not_found(+Level)
- The system does a pre-check for the existence of
all references RDF databases. If Level is
error
it reports missing databases as an error and fails. Ifwarning
it prints them, but continues. Ifsilent
, no checks are preformed. Default iserror
. - concurrent(Threads)
- Perform the load concurrently using N threads. If not specified, the number is determined by guess_concurrency/2.
- load(+Bool)
- If
false
, to all the preparation, but do not execute the actual loading. See also rdf_list_library/2.
- rdf_list_library(+Id) is det
- rdf_list_library(+Id, +Options) is det
- Print library dependency tree to the terminal. Options include
options for rdf_load_library/2 and
- show_source(+Boolean)
- If
true
(default), show location we are loading - show_graph(+Boolean)
- If
true
(defaultfalse
), show name of graph - show_virtual(+Boolean)
- If
false
(defaulttrue
), do not show virtual repositories. - indent(Atom)
- Atom repeated for indentation levels