Re: Exporting Data from VARS

31 views
Skip to first unread message

Brian Schlining

unread,
Jul 6, 2011, 1:07:08 PM7/6/11
to Ambrose Bonnaire-Sergeant, mbari...@googlegroups.com
Hi Ambrose,

> I was thinking of implementing this in Clojure, it would be run periodically to output RDF.
Yep, Clojure should work just fine.
> How would I establish a connection to a database and get an annotation "record" via a DAO?
The easiest thing to do is get a 'ToolBelt' object. Most of the database stuff can be auto-wired together using Guice; the pseudo code for that is:
----------
import com.google.inject.Injector
import com.google.inject.Guice
import vars.shared.InjectorModule
import vars.annotation.ui.ToolBelt

injector = Guide.createInjector(new InjectorModule("annotation-app")
toolBelt = injector.getInstance(ToolBelt.class)
----------


You can create the DAO objects via factories. The DAO can handle all the database stuff (search, update, delete, persist, etc). You can get DAO like so:
---------
% use the AnnotationDAOFactory for accessing video annotation information
observationDao = toolBelt.getAnnotationDAOFactory().newObservationDAO()

% use the KnowledgebaseDAOFactory for accessing knowledgebase information
conceptDao = toolBelt.getKnowledgebaseDAOFactory().newConceptDAO()
----------
The full DAO docs can be found at:
http://vars.sourceforge.net/javadoc/reference/vars/annotation/jpa/package-summary.html
http://vars.sourceforge.net/javadoc/reference/vars/knowledgebase/jpa/package-summary.html

Each type of object has a corresponding DAO. Generally speaking, only the 'find' methods are specialized for a type of object. (i.e. use a ConceptDAO to find Concept objects); the delete, persist and other methods are non specific. For example, I can persist a VideoFrame object with any annotation DAO object, such as a PhysicalDataDAO.

The object model and ER diagrams can be found at
http://vars.sourceforge.net/Development/datastructure.shtml

If you look in VARS_HOME\scripts\groovy there's a number of files that show how the VARS API's are used. For example, take a look at 'sendPendingHistories.groovy' for a simple example. (NOTE: Just a reminder that when looking at that code, Groovy allows get/set methods to be called without the get/set prefix. For example 'toolBelt.getKnowledgebaseDAOFactory()' can be called as 'toolBelt.knowledgebaseDAOFactory' un Groovy)

> Which Java
> classes are relevant? I'm not sure what the difference between the vars.knowledgebase and vars.annotation
> namespaces.

The knowledgebase basically stores terms that can be used to annotate (i.e. it's a constrained vocabulary). As an example, we have a phylogenetic tree modeled in the knowledgebase which defines the taxonomic hierarchy of critters that we see with our remotely operated vehicles.

Annotations are the actual info that users annotate. This include information about what tape or video file is being annotated, which camera/ROV was used to record the video, what videoframe an annotation is attached to, the actual time that the frame was recorded, what was seen in the video frame, where the camera was located when it was recording, etc.

Hope that helps!

Cheers

-- B
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Brian Schlining
MBARI
Software Engineer
br...@mbari.org (mailto:br...@mbari.org)
(831)775-1855
http://www.mbari.org/staff/brian

Ambrose Bonnaire-Sergeant

unread,
Jul 7, 2011, 4:48:28 AM7/7/11
to mbari...@googlegroups.com, Ankur Sharda
Hi Brian,

Thanks for the pointers.

Just a simple question, I see mbari has a maven repository, but where is the current VARS code kept?

This is the closest I could find, seems out of date:

For now I'm just compiling locally with "mvn install".

Thanks,
Ambrose

--
You received this message because you are subscribed to the Google Groups "mbari-vars" group.
To post to this group, send email to mbari...@googlegroups.com.
To unsubscribe from this group, send email to mbari-vars+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mbari-vars?hl=en.


Brian Schlining

unread,
Jul 7, 2011, 12:15:36 PM7/7/11
to mbari...@googlegroups.com, Ankur Sharda
Hi Ambrose,

>
> Just a simple question, I see mbari has a maven repository, but where is the current VARS code kept?
The main branch of VARS code lives at http://code.google.com/p/vars-redux/ . I made a branch for video file support which you can check out and build using:

hg clone https://bschl...@bschlining-with-file-support.googlecode.com/hg/ vars-with-file-support
cd vars-with-file-support
mvn install -P dev

The -P flag indicates the profile to use to build it; the default is 'dev'. The profile customizes the build for different targets. In your case, I'd recommend editing the following files:

1) vars-with-file-support/vars-annotation/src/main/filters/dev.properties
- You can change the default ships/camera platforms as well as the title of the VARS app
2) vars-with-file-support/vars-jpa/src/main/filters/dev.properties
- You set you database specific properties (jdbc url, driver, password, username). In your case, the annotation, knowledgebase and misc properties should all point at the same database (your postgresql setup)

If you make those changes VARS will build for your custom database. Also, when you run 'mvn install' an assembly is built that's pretty much the same as the one you download from sourceforge except that it'll point at your database. The assembly will be built as: vars-with-file-support/vars-standalone/target/vars-standalone-6.0.4-SNAPSHOT-scripting.zip.

>
> This is the closest I could find, seems out of date:
> http://mbari-maven-repository.googlecode.com/svn/repository/org/mbari/vars-core/
>
> For now I'm just compiling locally with "mvn install".

Because VARS has database specific builds, I don't VARS jars to a maven repo. You'll have to build from source (which will install it in your local maven repo at ~/.m2/repository)


p.s. If you get to the point where you want to deploy VARS applications via Java Web Start (so a user launches them by clicking on a link on a web page). I have a maven project that I can send you that makes VARS webstart apps.

Cheers
--
Brian Schlining


Brian Schlining

unread,
Jul 7, 2011, 12:44:53 PM7/7/11
to mbari...@googlegroups.com, Ankur Sharda

> >
> > Just a simple question, I see mbari has a maven repository, but where is the current VARS code kept?
> The main branch of VARS code lives at http://code.google.com/p/vars-redux/ . I made a branch for video file support which you can check out and build using:
>
> hg clone https://bschl...@bschlining-with-file-support.googlecode.com/hg/ vars-with-file-support
> cd vars-with-file-support
> mvn install -P dev
p.p.s. I should mention 2 things:
1) The first time your run the maven build for VARS takes forever; it feels like it's downloading half the internet. Subsequent builds will be much much faster.
2) As the build runs the unit tests, you'll see a ton of database logging messages fly by. Those tests are executed against a temporary in-memory database, NOT against the one you configured in the dev.properties files.

--
Brian Schlining


Reply all
Reply to author
Forward
0 new messages