[Mulgara-svn] r349 - branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast
pag at mulgara.org
pag at mulgara.org
Sat Aug 18 18:32:11 UTC 2007
Author: pag
Date: 2007-08-18 13:32:11 -0500 (Sat, 18 Aug 2007)
New Revision: 349
Added:
branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/BooleanSetCommand.java
branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Deletion.java
branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/ExecuteScript.java
branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Insertion.java
branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Load.java
branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Modification.java
branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetAutoCommit.java
branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetCommand.java
branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetTime.java
Modified:
branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetUser.java
Log:
Continuing to expand on the AST for querying. Still a few things left to do. No double dispatch included yet, but this will be wanted.
Added: branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/BooleanSetCommand.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/BooleanSetCommand.java 2007-08-18 18:30:16 UTC (rev 348)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/BooleanSetCommand.java 2007-08-18 18:32:11 UTC (rev 349)
@@ -0,0 +1,40 @@
+/**
+ * The contents of this file are subject to the Open Software License
+ * Version 3.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.opensource.org/licenses/osl-3.0.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ */
+package org.mulgara.query.ast;
+
+/**
+ * This class indicates a command for the UI to set a local boolean property.
+ * @created Aug 17, 2007
+ * @author Paul Gearon
+ * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
+ * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
+ */
+public abstract class BooleanSetCommand extends SetCommand {
+
+ /** Indicates that option has been set on or off. */
+ private boolean on;
+
+ /**
+ * Create a command to set and option on or off.
+ * @param on <code>true</code> if the option is on.
+ */
+ public BooleanSetCommand(boolean on) {
+ this.on = on;
+ }
+
+ /**
+ * @return the set option
+ */
+ public boolean isOn() {
+ return on;
+ }
+}
Added: branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Deletion.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Deletion.java 2007-08-18 18:30:16 UTC (rev 348)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Deletion.java 2007-08-18 18:32:11 UTC (rev 349)
@@ -0,0 +1,47 @@
+/**
+ * The contents of this file are subject to the Open Software License
+ * Version 3.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.opensource.org/licenses/osl-3.0.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ */
+package org.mulgara.query.ast;
+
+import java.net.URI;
+import java.util.Set;
+
+import org.jrdf.graph.Triple;
+import org.mulgara.query.Query;
+
+/**
+ * An AST element for deleting from a graph.
+ * @created Aug 15, 2007
+ * @author Paul Gearon
+ * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
+ * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
+ */
+public class Deletion extends Modification {
+
+ /**
+ * Create a deletion command for deleting a set of statements from a graph.
+ * @param graph The graph to delete from.
+ * @param statements The data to be deleted.
+ */
+ public Deletion(URI graph, Set<Triple> statements){
+ super(graph, statements);
+ }
+
+ /**
+ * Create an deletion command for deleting the results of a query from a graph.
+ * @param graph The graph to delete from.
+ * @param selectQuery The query to get data from for deletion.
+ */
+ public Deletion(URI graph, Query selectQuery){
+ super(graph, selectQuery);
+ }
+
+}
Added: branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/ExecuteScript.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/ExecuteScript.java 2007-08-18 18:30:16 UTC (rev 348)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/ExecuteScript.java 2007-08-18 18:32:11 UTC (rev 349)
@@ -0,0 +1,52 @@
+/**
+ * The contents of this file are subject to the Open Software License
+ * Version 3.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.opensource.org/licenses/osl-3.0.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ */
+package org.mulgara.query.ast;
+
+import java.net.URI;
+import java.net.URL;
+
+/**
+ * An AST element for running an external script.
+ * @created Aug 14, 2007
+ * @author Paul Gearon
+ * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
+ * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
+ */
+public class ExecuteScript extends LocalAst {
+
+ /** The script to be executed. */
+ private URL script;
+
+ /**
+ * Creates a script execution command.
+ * @param script The script to execute.
+ */
+ public ExecuteScript(URL script) {
+ this.script = script;
+ }
+
+ /**
+ * Indicates that this is a command for the UI.
+ * @return <code>true</code> to indicated that script execution is a UI feature.
+ */
+ public boolean isUICommand() {
+ return true;
+ }
+
+ /**
+ * @return the script URL
+ */
+ public URL getScript() {
+ return script;
+ }
+
+}
Added: branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Insertion.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Insertion.java 2007-08-18 18:30:16 UTC (rev 348)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Insertion.java 2007-08-18 18:32:11 UTC (rev 349)
@@ -0,0 +1,47 @@
+/**
+ * The contents of this file are subject to the Open Software License
+ * Version 3.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.opensource.org/licenses/osl-3.0.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ */
+package org.mulgara.query.ast;
+
+import java.net.URI;
+import java.util.Set;
+
+import org.jrdf.graph.Triple;
+import org.mulgara.query.Query;
+
+/**
+ * An AST element for inserting into a graph.
+ * @created Aug 14, 2007
+ * @author Paul Gearon
+ * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
+ * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
+ */
+public class Insertion extends Modification {
+
+ /**
+ * Create an insertion command for inserting a set of statements into a graph.
+ * @param graph The graph to insert into.
+ * @param statements The data to be inserted.
+ */
+ public Insertion(URI graph, Set<Triple> statements){
+ super(graph, statements);
+ }
+
+ /**
+ * Create an insertion command for inserting the results of a query into a graph.
+ * @param graph The graph to insert into.
+ * @param selectQuery The query to get data from for insertion.
+ */
+ public Insertion(URI graph, Query selectQuery){
+ super(graph, selectQuery);
+ }
+
+}
Added: branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Load.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Load.java 2007-08-18 18:30:16 UTC (rev 348)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Load.java 2007-08-18 18:32:11 UTC (rev 349)
@@ -0,0 +1,79 @@
+/**
+ * The contents of this file are subject to the Open Software License
+ * Version 3.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.opensource.org/licenses/osl-3.0.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ */
+package org.mulgara.query.ast;
+
+import java.net.URI;
+
+/**
+ * Represents a command to load data into a model.
+ *
+ * @created Aug 13, 2007
+ * @author Paul Gearon
+ * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
+ * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
+ */
+public class Load implements CommandAst {
+
+ /** The source of data to insert. */
+ private URI source;
+
+ /** The graph to load data into. */
+ private URI destination;
+
+ /**
+ * Create a new load command.
+ * @param source The source of data to insert.
+ * @param destination The graph to load data into.
+ */
+ public Load(URI source, URI destination) {
+ this.source = source;
+ this.destination = destination;
+ }
+
+ /**
+ * @return The URI of the destination graph.
+ */
+ public URI getServerURI() throws UnsupportedOperationException {
+ return destination;
+ }
+
+ /**
+ * Returns false to indicate that this is a server-side operation.
+ * @return Always <code>false</code>
+ */
+ public boolean isLocalOperation() {
+ return false;
+ }
+
+ /**
+ * Returns false to indicate that this operation is not tied to a UI.
+ * @return Always <code>false</code>
+ */
+ public boolean isUICommand() {
+ return false;
+ }
+
+ /**
+ * @return the URI of the source data.
+ */
+ public URI getSource() {
+ return source;
+ }
+
+ /**
+ * @return the destination URI for the data.
+ */
+ public URI getDestination() {
+ return destination;
+ }
+
+}
Added: branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Modification.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Modification.java 2007-08-18 18:30:16 UTC (rev 348)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/Modification.java 2007-08-18 18:32:11 UTC (rev 349)
@@ -0,0 +1,93 @@
+package org.mulgara.query.ast;
+
+import java.net.URI;
+import java.util.Set;
+
+import org.jrdf.graph.Triple;
+import org.mulgara.query.Query;
+
+public abstract class Modification implements CommandAst {
+
+ /** The graph to insert into. */
+ protected URI graph;
+ /** A SELECT query where the results are to be inserted into the graph. */
+ protected Query selectQuery;
+ /** A set of statements to be inserted into the graph. */
+ protected Set<Triple> statements;
+
+ /**
+ * Create a modification command for modifying a set of statements in a graph.
+ * @param graph The graph to modify.
+ * @param statements The data to be modified.
+ */
+ public Modification(URI graph, Set<Triple> statements){
+ this.graph = graph;
+ this.statements = statements;
+ }
+
+ /**
+ * Create a modification command for modifying the results of a query in a graph.
+ * @param graph The graph to modify.
+ * @param selectQuery The query to get data for modification.
+ */
+ public Modification(URI graph, Query selectQuery){
+ this.graph = graph;
+ this.selectQuery = selectQuery;
+ }
+
+ /**
+ * Retrieve the URI for a graph on the server receiving the data.
+ * @return The server containing the graph to insert into.
+ */
+ public URI getServerURI() throws UnsupportedOperationException {
+ return graph;
+ }
+
+ /**
+ * Indicates that this is a server command.
+ * @return <code>false</code> to indicate that this command involves a server.
+ */
+ public boolean isLocalOperation() {
+ return false;
+ }
+
+ /**
+ * Indicates that this is not a UI command.
+ * @return <code>false</code> to indicate that this command is unconcerned with the client.
+ */
+ public boolean isUICommand() {
+ return false;
+ }
+
+ /**
+ * Test is this insertion is based on a SELECT query.
+ * @return <code>true</code> if the data to be inserted comes from a SELECT query.
+ * <code>false</code> otherwise.
+ */
+ public boolean isSelectBased() {
+ assert selectQuery == null ^ statements == null;
+ return selectQuery != null;
+ }
+
+ /**
+ * @return the graph
+ */
+ public URI getGraph() {
+ return graph;
+ }
+
+ /**
+ * @return the selectQuery
+ */
+ public Query getSelectQuery() {
+ return selectQuery;
+ }
+
+ /**
+ * @return the statements
+ */
+ public Set<Triple> getStatements() {
+ return statements;
+ }
+
+}
\ No newline at end of file
Added: branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetAutoCommit.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetAutoCommit.java 2007-08-18 18:30:16 UTC (rev 348)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetAutoCommit.java 2007-08-18 18:32:11 UTC (rev 349)
@@ -0,0 +1,31 @@
+/**
+ * The contents of this file are subject to the Open Software License
+ * Version 3.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.opensource.org/licenses/osl-3.0.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ */
+package org.mulgara.query.ast;
+
+/**
+ * Indicates a UI request to automatically commit after executing a write operation.
+ * @created Aug 17, 2007
+ * @author Paul Gearon
+ * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
+ * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
+ */
+public class SetAutoCommit extends BooleanSetCommand {
+
+ /**
+ * Create a command to set autocommit on or off.
+ * @param option The value to set the time recording to.
+ */
+ public SetAutoCommit(boolean option) {
+ super(option);
+ }
+
+}
Added: branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetCommand.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetCommand.java 2007-08-18 18:30:16 UTC (rev 348)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetCommand.java 2007-08-18 18:32:11 UTC (rev 349)
@@ -0,0 +1,31 @@
+/**
+ * The contents of this file are subject to the Open Software License
+ * Version 3.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.opensource.org/licenses/osl-3.0.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ */
+package org.mulgara.query.ast;
+
+/**
+ * This class indicates a command for the UI to set a local property.
+ * @created Aug 17, 2007
+ * @author Paul Gearon
+ * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
+ * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
+ */
+public abstract class SetCommand extends LocalAst {
+
+ /**
+ * Check if this command is for the local UI.
+ * @return <code>true</code> to indicate that this command is for the UI only.
+ */
+ public boolean isUICommand() {
+ return true;
+ }
+
+}
Added: branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetTime.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetTime.java 2007-08-18 18:30:16 UTC (rev 348)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetTime.java 2007-08-18 18:32:11 UTC (rev 349)
@@ -0,0 +1,30 @@
+/**
+ * The contents of this file are subject to the Open Software License
+ * Version 3.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.opensource.org/licenses/osl-3.0.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ */
+package org.mulgara.query.ast;
+
+/**
+ * Indicates a UI request to record timing information for executing an operation.
+ * @created Aug 17, 2007
+ * @author Paul Gearon
+ * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
+ * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
+ */
+public class SetTime extends BooleanSetCommand {
+
+ /**
+ * Create a command to set timing on or off.
+ * @param option The value to set the time recording to.
+ */
+ public SetTime(boolean option) {
+ super(option);
+ }
+}
Modified: branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetUser.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetUser.java 2007-08-18 18:30:16 UTC (rev 348)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/query/ast/SetUser.java 2007-08-18 18:32:11 UTC (rev 349)
@@ -23,7 +23,7 @@
* @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
* @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
*/
-public class SetUser implements CommandAst {
+public class SetUser extends LocalAst {
/** The user logging in. */
private String user;
@@ -45,14 +45,6 @@
this.password = password;
this.securityDomain = securityDomain;
}
-
- /**
- * Indicates that this operation may require network access.
- * @return <code>false</code> as network access may be needed.
- */
- public boolean isLocalOperation() {
- return false;
- }
/**
@@ -65,15 +57,6 @@
/**
- * Requests a server URI for this operation. None available, as it
- * operates on the local connection.
- * @return <code>null</code>
- */
- public URI getServerURI() {
- return null;
- }
-
- /**
* Retrieves the user name.
* @return the user
*/
@@ -81,6 +64,7 @@
return user;
}
+
/**
* Retrieves the user password.
* @return the password
@@ -89,6 +73,7 @@
return password;
}
+
/**
* Retrieves the URI of the security domain.
* @return the securityDomain
More information about the Mulgara-svn
mailing list