9.1 The Manifest file
A manifest file is an RDF file, often in
Turtle
format, that provides meta-data about RDF resources. Often, a manifest
will describe RDF files in the current directory, but it can also
describe RDF resources at arbitrary URL locations. The RDF schema for
RDF library meta-data can be found in rdf_library.ttl
. The
namespace for the RDF library format is defined as
http://www.swi-prolog.org/rdf/library/
and abbreviated as
lib
.
The schema defines three root classes: lib:Namespace, lib:Ontology and lib:Virtual, which we describe below.
- lib:Ontology
- This is a subclass of owl:Ontology. It has two subclasses, lib:Schema
and lib:Instances. These three classes are currently processed equally.
The following properties are recognised on lib:Ontology:
- dc:title
- Title of the ontology. Displayed by rdf_list_library/0.
- owl:versionInfo
- Version of the ontology. Displayed by rdf_list_library/0.
- owl:imports
- Ontologies imported. If rdf_load_library/2 is used to load this ontology, the ontologies referenced here are loaded as well. There are two subProperties: lib:schema and lib:instances with the obvious meaning.
- lib:source
- Defines the named graph into which the resource is loaded. If this ends
in a
, the basename of each loaded file is appended to the given source. Defaults to the URL the RDF is loaded from./
- lib:baseURI
- Defines the base for processing the RDF data. If not provided this defaults to the named graph, which in turn defaults to the URL the RDF is loaded from.
- lib:Virtual
- Virtual ontologies do not refer to an RDF resource themselves. They only
import other resources. For example the W3C WordNet manifest defines
wn-basic
andwn-full
as virtual resources. The lib:Virtual resource is used as a second rdf:type:<wn-basic> a lib:Ontology ; a lib:Virtual ; ...
- lib:CloudNode
- Used by ClioPatria to combine this ontology and all data it imports into a node in the automatically generated datacloud.
- lib:Namespace
- Defines a URL to be a namespace. The definition provides the preferred
mnemonic and can be referenced in the lib:providesNamespace and
lib:usesNamespace properties. The rdf_load_library/2
predicates registers encountered namespace mnemonics with rdf-db using
rdf_register_ns/2.
Typically namespace declarations use @prefix declarations. E.g.
@prefix lib: <http://www.swi-prolog.org/rdf/library/> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . [ a lib:Namespace ; lib:mnemonic "rdfs" ; lib:namespace rdfs: ] .
9.1.1 Support for the VoID and VANN vocabularies
The VoID aims at resolving the same problem as the Manifest files described here. In addition, the VANN vocabulary provides the information about preferred namepaces prefixes. The RDF library manager can deal with VoID files. The following relations apply:
- VoID
Dataset
andLinkset
are similar tolib:Ontology
, but a VoID resource is always Virtual. I.e., the VoID URI itself never refers to an RDF document. - The
owl:imports
and its lib specializations are replaced byvoid:subset
(referring to another VoID dataset) andvoid:dataDump
(referring to a concrete document). - A description of the dataset is given using
dcterms:description
rather thanrdfs:comment
- The RDF library recognises
lib:source
,lib:baseURI
andlib:Cloudnode
, which have no equivalent in VoID. - The RDF library recognises
vann:preferredNamespacePrefix
andvann:preferredNamespaceUri
as alternatives to its proprietary way for defining prefixes. The domain of these predicates is unclear. The library recognises them regardless of the domain. Note that the range ofvann:preferredNamespaceUri
is a literal. A disadvantage of that is that the Turtle prefix declaration cannot be reused.
Currently, the RDF metadata is not stored in the RDF database. It is processed by low-level primitives that do not perform RDFS reasoning. In particular, this means that rdfs:supPropertyOf and rdfs:subClassOf cannot be used to specialise the RDF meta vocabulary.
9.1.2 Finding manifest files
The initial metadata file(s) are loaded into the system using rdf_attach_library/1.
- rdf_attach_library(+FileOrDirectory)
- Load meta-data on RDF repositories from FileOrDirectory. If
the argument is a directory, this directory is processed recursively and
each for each directory, a file named
void.ttl
,Manifest.ttl
orManifest.rdf
is loaded (in this order of preference).Declared namespaces are added to the rdf-db namespace list. Encountered ontologies are added to a private database of
rdf_list_library.pl
. Each ontology is given an identifier, derived from the basename of the URL without the extension. This, using the declaration below, the identifier of the declared ontology iswn-basic
.<wn-basic> a void:Dataset ; dcterms:title "Basic WordNet" ; ...
- rdf_list_library
- List the available resources in the library. Currently only lists resources that have a dcterms:title property. See section 9.2 for an example.
It is possible for the initial set of manifests to refer to RDF files that are not covered by a manifest. If such a reference is encountered while loading or listing a library, the library manager will look for a manifest file in the directory holding the referenced RDF file and load this manifest. If a manifest is found that covers the referenced file, the directives found in the manifest will be followed. Otherwise the RDF resource is simply loaded using the current defaults.
Further exploration of the library is achieved using rdf_list_library/1 or rdf_list_library/2:
- rdf_list_library(+Id)
- Same as
rdf_list_library(Id,[])
. - rdf_list_library(+Id, +Options)
- Lists the resources that will be loaded if Id is handed to rdf_load_library/2. See rdf_attach_library/1 for how ontology identifiers are generated. In addition it checks the existence of each resource to help debugging library dependencies. Before doing its work, rdf_list_library/2 reloads manifests that have changed since they were loaded the last time. For HTTP resources it uses the HEAD method to verify existence and last modification time of resources.
- rdf_load_library(+Id, +Options)
- Load the given library. First rdf_load_library/2 will establish what resources need to be loaded and whether all resources exist. Than it will load the resources.