Rdfstore 2.0 Documentation


About

Rdfstore 2.0 is the Ricordo metadata wrapper. It serves as a messenger between SPARQL endpoint and end-user, alleviating the need to learn complicated SPARQL syntax just to deal with metadata. This is done with a system of templates, which are customized at the organizational level. The end-user tells the appropriate systems team: ``I want a form that'll let me query the database for X.'' The team creates a template for that query. Now the end-user can select that template and query the database for X by filling out a simple form, no SPARQL required.

The original Rdfstore was programmed by Sarala Wimaralatne. Version 2.0 was programmed by Sam Alexander for the Farr Institute.

License

        Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0

        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and
        limitations under the License.
      

Quick Nav


Installation

Installation is as follows.

  1. Assumption: You already have a triplestore running, with a SPARQL endpoint.
  2. Ensure a java runtime and java compiler are installed.
  3. Use "git clone", or any other means, to copy the repository from http://github.org/semitrivial/rdfstore
  4. Within the directory containing the copy of the repository, compile Rdfstore using "make" (or manually: "javac -g Rdfstore.java")
  5. Within that directory, run "java Rdfstore -help" to get help on the command line arguments, or see further below.
  6. In order for Rdfstore to be useful, you'll want to create some templates. See templates below.

Commandline arguments

Rdfstore can be run with the following commandline arguments.

  • -templates <directory>: Specifies the location of the directory containing Rdfstore templates. Default: ./templates
  • -endpoint <URL>: Specifies the SPARQL query endpoint location for your triplestore.
    For example, if queries to your endpoint look like
    • http://localhost:3030/ddmore/query?force-accept=text%2Fplain&output=tsv&query=SELECT...
    then you can use the following URL for the endpoint:
    • http://localhost:3030/ddmore/query?force-accept=text%2Fplain&output=tsv&query=
    See the triplestore-specific documentation for more details.
  • -method <GET or POST>: Specifies which HTTP method your SPARQL endpoint uses. Default: GET
  • -update <URL>: If your triplestore has a separate address for updates, specify that here. Default: copies "endpoint"
  • -updatemethod <GET or POST>: If your triplestore has a separate address for updates, specify the HTTP method here. Default: copies "method"
  • -format <format>: A string, containing "%s". The %s will be replaced by the query itself, useful for things like triplestore-specific preambles, etc. Default: %s
  • -port <number>: Specifies which port Rdfstore will listen for connections on. Default: 20060
  • -help: Displays a help screen.

Simple GUI

Rdfstore comes with a simple GUI. When Rdfstore is running, the GUI can be accessed at http://localhost:20060/gui/ (replace "localhost" with whatever host you're running Rdfstore on, and replace "20060" with whatever port your Rdfstore is running on, if necessary). For example, the demonstration instance of Rdfstore is running on host open-physiology.org on port 20060, so the GUI is at http://open-physiology.org:20060/gui

Please Note

The built-in GUI is mainly just for demonstration purposes. We anticipate Rdfstore will mainly be used directly via the API.

Templates

A template is a SPARQL query, possibly with up to ten parameters. Rdfstore reduces SPARQL to a matter of filling-in-the-blanks, namely, one blank for each parameter. Templates specific to your organization should be created by someone who knows SPARQL. The philosophy is: "construct the SPARQL once, run the query many times" (with different parameters).

Example: The SPARQL query to find all things which are "part-of" the class "acids" might look like so:
            SELECT DISTINCT ?part 
            WHERE
            {
              ?part <http://example.com/ontology#part-of> <http://example.com/ontology#acids>
            }
          
Now suppose you want a generic form for "find all things 'part-of' the class 'X'", where the end-user fills in X. Create a template file with a name like "get_parts_of.txt" with contents:
            SELECT DISTINCT ?part
            WHERE
            {
              ?part <http://example.com/ontology#part-of> <[0]>
            }
          
Here, [0] is a variable. Other available variables are [1] through [9].
Templates should be stored in a template directory. When you run Rdfstore, use the command line to tell Rdfstore which directory the templates are stored in (unless you use the default directory). The template's name (minus ".txt") will become part of Rdfstore's GUI. Assuming the template in the above example has been loaded by Rdfstore, the template can be accessed at an address like
  • http://yoururl.org:20060/get_parts_of/?0=acids

Advanced Template Commands

At the beginning of a template file, you can issue certain special commands. You can give a name to a variable, as in the following example:
          # 0 = whole
          SELECT DISTINCT ?part
          WHERE
          {
            ?part <http://example.com/ontology#part-of> <[0]>
          }
        
In this example, the command is that first line, # 0 = whole. It says that the name of the variable 0 is 'whole' (so the template is searching for 'parts' of the 'whole'). This is how the Rdfstore demo GUI knows which placeholder text to put in the different form fields.
The other type of command you can use here is a preprocessor command, as in the following example:
          # 0 = whole
          # Preprocessor0 = http://open-physiology.org:20080/terms/%s?longURI=yes&json=yes
          SELECT DISTINCT ?part
          WHERE
          {
            ?part <http://example.com/ontology#part-of> <[0]>
          }
        
The command, # Preprocessor0 = http://open-physiology.org:20080/terms/%s?longURI=yes&json=yes, indicates that the contents of variable 0 will be passed through the indicated preprocessor. For example, if the user enters 'FMA_50801' for variable 0, Rdfstore will replace the '%s' in the Proprocessor0 string with 'FMA_50801' to get the URL: http://open-physiology.org:20080/terms/FMA_50801?longURI=yes&json=yes which points to OWLKB and gets a list of subclasses of FMA_50801. Rdfstore will use that list of subclasses, and query the triplestore for all things which are part-of any subclass of FMA_50801.

Mailing List

Rdfstore does not currently have its own separate mailing list, but for the time being, questions (general or technical) can be posted to the OWLKB-Questions mailing list:


The API

Rdfstore has a dynamic API. The API is defined by the templates your organization creates. For each template, there is a corresponding API command. If the template is named X.txt, and depends on parameters [0], [1], and [2], then the API command looks like

          http://example.com:20060/X/?0=fill_this_in&1=also_fill_this&2=this_too
        

Quick Nav