[Mulgara-svn] r720 - in trunk/src/jar: itql/java/org/mulgara/itql itql/sablecc query/java/org/mulgara/parser
pag at mulgara.org
pag at mulgara.org
Fri Mar 28 21:30:39 UTC 2008
Author: pag
Date: 2008-03-28 14:30:39 -0700 (Fri, 28 Mar 2008)
New Revision: 720
Modified:
trunk/src/jar/itql/java/org/mulgara/itql/TqlInterpreter.java
trunk/src/jar/itql/sablecc/itql.grammar
trunk/src/jar/query/java/org/mulgara/parser/Interpreter.java
Log:
Added command for listing aliases, and added the SKOS and FOAF namespaces into the default alias list. Due to the SableCC change it may be necessary for Eclipse users to rebuild ideSupport.jav
Modified: trunk/src/jar/itql/java/org/mulgara/itql/TqlInterpreter.java
===================================================================
--- trunk/src/jar/itql/java/org/mulgara/itql/TqlInterpreter.java 2008-03-28 19:05:55 UTC (rev 719)
+++ trunk/src/jar/itql/java/org/mulgara/itql/TqlInterpreter.java 2008-03-28 21:30:39 UTC (rev 720)
@@ -159,6 +159,8 @@
aliases.put(MULGARA, URI.create(MULGARA_NS));
aliases.put(KRULE, URI.create(KRULE_NS));
aliases.put(DC, URI.create(DC_NS));
+ aliases.put(SKOS, URI.create(SKOS_NS));
+ aliases.put(FOAF, URI.create(FOAF_NS));
return aliases;
}
@@ -483,6 +485,21 @@
/**
+ * Requests a list of current aliases.
+ *
+ * @param node the alias command
+ */
+ public void outAAliaslCommand(AAliaslCommand node) {
+
+ // log the command
+ if (logger.isDebugEnabled()) logger.debug("Processing alias list command " + node);
+
+ // Return an AST element, for reporting on what happened.
+ // Use a Help command, with the alias listing as the help text.
+ lastCommand = new Help(buildAliasList());
+ }
+
+ /**
* Applies a set of rules in a model to data in another model.
*
* @param node the alias command
@@ -1306,6 +1323,19 @@
/**
+ * Writes the alias map as a set of URI/namespace pairs to a string for printing.
+ * @return A String containing all the alias mappings.
+ */
+ private String buildAliasList() {
+ StringBuilder buffer = new StringBuilder();
+ for (Map.Entry<String,URI> alias: getAliasMap().entrySet()) {
+ buffer.append(alias.getKey()).append(": <").append(alias.getValue()).append(">\n");
+ }
+ return buffer.toString();
+ }
+
+
+ /**
* Log the TQL command to a specified file
*
* @param command The TQL command to be validated
Modified: trunk/src/jar/itql/sablecc/itql.grammar
===================================================================
--- trunk/src/jar/itql/sablecc/itql.grammar 2008-03-28 19:05:55 UTC (rev 719)
+++ trunk/src/jar/itql/sablecc/itql.grammar 2008-03-28 21:30:39 UTC (rev 720)
@@ -121,6 +121,7 @@
command =
{alias} alias [target]:resource as [prefix]:identifier |
+ {aliasl} alias |
{apply} apply [rules]:resource to [base]:resource [destination]:resource? |
{backup} backup [source]:resource to [locality]:locality? [destination]:resource |
{commit} commit |
Modified: trunk/src/jar/query/java/org/mulgara/parser/Interpreter.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/parser/Interpreter.java 2008-03-28 19:05:55 UTC (rev 719)
+++ trunk/src/jar/query/java/org/mulgara/parser/Interpreter.java 2008-03-28 21:30:39 UTC (rev 720)
@@ -36,6 +36,12 @@
/** The Dublin Core namespace prefix. */
public static final String DC = "dc";
+ /** The Simple Knowledge Organization System namespace prefix. */
+ public static final String SKOS = "skos";
+
+ /** The Friend Of A Friend namespace prefix. */
+ public static final String FOAF = "foaf";
+
/** The URI of the rdf namespace. */
public static final String RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
@@ -54,6 +60,12 @@
/** The URI of the dc namespace. */
public static final String DC_NS = "http://purl.org/dc/elements/1.1/";
+ /** The URI of the skos namespace. */
+ public static final String SKOS_NS = "http://www.w3.org/2004/02/skos/core#";
+
+ /** The URI of the foaf namespace. */
+ public static final String FOAF_NS = "http://xmlns.com/foaf/0.1/";
+
/**
* Parses the given TQL command.
*
More information about the Mulgara-svn
mailing list