Project

General

Profile

Actions

Alias

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


h2. 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:
<pre>
alias;
</pre>

This will print all aliases that are currently registered.

h2. Adding Aliases

The general form for adding an alias is:
<pre>
alias resource as namespace;
</pre>
Where @resource@ is the URI prefix to abbreviate and @namespace@ is an unquoted XML namespace prefix.

h2. Examples

Look at the default set of aliases:
<pre>
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#>
</pre>
Add aliases:
<pre>
alias <http://www.w3.org/1999/xhtml#> as xml;
alias <http://www.w3.org/2001/XMLSchema#> as xsd;
</pre>
Updating an alias:
<pre>
alias <http://www.w3.org/2001/XMLSchema-datatypes#> as xsd;
</pre>
*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.
<pre>
select $obj $pred from <http://purl.org/dc/elements/1.1/>
where <http://purl.org/dc/elements/1.1/title> $pred $obj;
</pre>
With the alias command, this can be simplified to:
<pre>
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;
</pre>

Updated by Gregg - over 14 years ago ยท 4 revisions