Alias

Views all aliases, or creates an alias to a resource. This simplifies queries by using qualified names instead of element references within constraints.

Viewing Aliases

Mulgara has a set of predefined aliases on startup. These can be viewed along with any user-defined aliases by using the alias command without any arguments:

alias;

This will print all aliases that are currently registered.

Adding Aliases

The general form for adding an alias is:

alias resource as namespace;

Where resource is the URI prefix to abbreviate and namespace is an unquoted XML namespace prefix.

Examples

Look at the default set of aliases:

alias;

mulgara:  <http://mulgara.org/mulgara#>
dc:  <http://purl.org/dc/elements/1.1/>
rdfs:  <http://www.w3.org/2000/01/rdf-schema#>
foaf:  <http://xmlns.com/foaf/0.1/>
krule:  <http://mulgara.org/owl/krule/#>
rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
skos:  <http://www.w3.org/2004/02/skos/core#>
owl:  <http://www.w3.org/2002/07/owl#>

Add aliases:

alias <http://www.w3.org/1999/xhtml#> as xml;
alias <http://www.w3.org/2001/XMLSchema#> as xsd;

Updating an alias:

alias <http://www.w3.org/2001/XMLSchema-datatypes#> as xsd;

Note: The interpreter does not know which namespaces are followed by paths and which are followed by fragments. For this reason the trailing # or / character must be included by the user. This is demonstrated in the above aliases.

In the following example, the where clause in the following select command uses a complete URI.

select $obj $pred from <http://purl.org/dc/elements/1.1/>
where <http://purl.org/dc/elements/1.1/title> $pred $obj;

With the alias command, this can be simplified to:

alias <http://purl.org/dc/elements/1.1/> as dc;
select $obj $pred from <http://purl.org/dc/elements/1.1/> where <dc:title> $pred $obj;