[Mulgara-svn] r1281 - in trunk/src/jar/querylang: java/org/mulgara/itql sablecc

pag at mulgara.org pag at mulgara.org
Tue Sep 30 05:57:33 UTC 2008


Author: pag
Date: 2008-09-29 22:57:33 -0700 (Mon, 29 Sep 2008)
New Revision: 1281

Modified:
   trunk/src/jar/querylang/java/org/mulgara/itql/TqlInterpreter.java
   trunk/src/jar/querylang/sablecc/itql.grammar
Log:
Made the backup source, and restore destination parameters in TQL optional

Modified: trunk/src/jar/querylang/java/org/mulgara/itql/TqlInterpreter.java
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/itql/TqlInterpreter.java	2008-09-30 05:56:16 UTC (rev 1280)
+++ trunk/src/jar/querylang/java/org/mulgara/itql/TqlInterpreter.java	2008-09-30 05:57:33 UTC (rev 1281)
@@ -696,11 +696,16 @@
     if (logger.isDebugEnabled()) logger.debug("Processing backup command " + node);
 
     // get constituents of the backup command
-    URI sourceURI = toURI(node.getSource());
     URI destinationURI = toURI(node.getDestination());
     boolean locality = node.getLocality() != null && (node.getLocality() instanceof ALocalLocality);
 
-    lastCommand = new Backup(sourceURI, destinationURI, locality);
+    Token src = node.getSource();
+    if (src != null) {
+      URI sourceURI = toURI(src);
+      lastCommand = new Backup(sourceURI, destinationURI, locality);
+    } else {
+      lastCommand = new Backup(destinationURI, locality);
+    }
   }
 
   /**
@@ -734,11 +739,16 @@
     // log the command
     if (logger.isDebugEnabled()) logger.debug("Processing restore command " + node);
 
-    URI destinationURI = toURI(node.getDestination());
     URI sourceURI = toURI(node.getSource());
     boolean locality = node.getLocality() != null && (node.getLocality() instanceof ALocalLocality);
 
-    lastCommand = new Restore(sourceURI, destinationURI, locality);
+    Token dest = node.getDestination();
+    if (dest != null) {
+      URI destinationURI = toURI(dest);
+      lastCommand = new Restore(sourceURI, destinationURI, locality);
+    } else {
+      lastCommand = new Restore(sourceURI, locality);
+    }
   }
 
   /**

Modified: trunk/src/jar/querylang/sablecc/itql.grammar
===================================================================
--- trunk/src/jar/querylang/sablecc/itql.grammar	2008-09-30 05:56:16 UTC (rev 1280)
+++ trunk/src/jar/querylang/sablecc/itql.grammar	2008-09-30 05:57:33 UTC (rev 1281)
@@ -124,7 +124,7 @@
     {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 |
+    {backup}    backup [source]:resource? to [locality]:locality? [destination]:resource |
     {commit}    commit                                                       |
     {create}    create [model]:resource [model_type]:resource?               |
     {delete}    delete triple_factor from resource                           |
@@ -136,7 +136,7 @@
     {insert}    insert triple_factor into resource                           |
     {load}      load [locality]:locality? [source]:resource into [destination]:resource |
     {quit}      quit                                                         |
-    {restore}   restore [destination]:resource from [locality]:locality? [source]:resource |
+    {restore}   restore [destination]:resource? from [locality]:locality? [source]:resource |
     {rollback}  rollback                                                     |
     {select}    query                                                        |
     {set}       set set_option set_option_mode                               |




More information about the Mulgara-svn mailing list