chb/smart_server — pull request #3 by jmandel (2012-04-06 00:04:24+00:00)
Title: Support for configurable triplestore engine backends.

Includes support for two options:

* sesame
* stardog

This set of changes alters the SMART Reference EMR's basic approach to querying for medical record data.

### Previously...
each time an API request came through we generated (on-the-fly) a big SPARQL query that described the entire shape of the data we wanted to query. It worked but became very slow with large datasets.

### Now...
we segregate related data into `contexts` on their way *in* to the triple store, assigning a context to each and every clinical statement. So when we want to pull data out, instead of generating a big hairy SPARQL query we can use something very simple like:

CONSTRUCT{ ?s ?p ?o. }
WHERE {
GRAPH ?g { ?s ?p ?o. }
} BINDINGS ?g {
()
}