[Mulgara-general] Mulgara API's

Paul Gearon gearon at ieee.org
Thu Feb 21 23:16:57 UTC 2008


Are you connecting to Mulgara in the same JVM, or as a remote process?
 If it's in the same JVM, then you can continue to use a session.
Otherwise, I recommend moving to using Connections (these wrap
sessions).  Unfortunately I haven't had time to document them yet.
:-(

The basic idea of the interface is to create a connection to a running
database.  You can then execute commands on this connection.  A simple
example (without exception handling) is:

Connection conn = new SessionConnection(URI.create("rmi://hostname/server1"));

Interpreter interpreter = new TqlInterpreter();
Command cmd = interpreter.parse("insert ......... into
<rmi://hostname/server1#data>;");
cmd.execute(conn);

cmd = interpreter.parse("select $x from <rmi://hostname/server1#data>
where $x $y $z;");
Answer answer = (Answer)cmd.execute(conn);


You can also manually create Commands if you want to do that instead
of using iTQL:

new SetAutoCommit(false).execute(conn);
new Load(fileUri, modelUri, false).execute(conn);
Command c = new Commit();
c.execute(conn);
new Load(fileUri2, modelUri, false).execute(conn);
c.execute(conn);


Yes, this looks a little backwards (Ronald pointed out that it should
look like connection.execute(command)).  I'll have to look at this,
but for the moment it works.

A more complete example (including the use of the connection factory)
is in org.mulgara.itql.TqlAutoInterpreter.

Paul

On Thu, Feb 21, 2008 at 3:19 PM, Alex Hall <alexhall at revelytix.com> wrote:
> Greetings All,
>
>  I am picking back up with Mulgara after a couple of years on other
>  projects.  We are in the process of replacing the existing Jena backend
>  to our software with Mulgara, so we will need fine-grain, programmatic
>  control over creating models, importing data, inserting/deleting
>  triples, executing queries, etc.  Is the Session API still the
>  recommended interface to use for these purposes?
>
>  Thanks,
>  Alex
>  _______________________________________________
>  Mulgara-general mailing list
>  Mulgara-general at mulgara.org
>  http://mulgara.org/mailman/listinfo/mulgara-general
>



More information about the Mulgara-general mailing list