Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::RdfStore Class Reference

#include <mitkRdfStore.h>

Public Types

typedef std::map< std::string, std::list< RdfNode > > ResultMap
 
typedef std::map< std::string, RdfUriPrefixMap
 

Public Member Functions

 RdfStore ()
 
 ~RdfStore ()
 
void SetBaseUri (RdfUri uri)
 
RdfUri GetBaseUri () const
 
void AddPrefix (std::string prefix, RdfUri uri)
 
PrefixMap GetPrefixes () const
 
void CleanUp ()
 
bool Add (RdfTriple triple)
 
bool Remove (RdfTriple triple)
 
bool Contains (RdfTriple triple)
 
ResultMap Query (const std::string &query) const
 
ResultMap ExecuteTupleQuery (const std::string &query) const
 
bool ExecuteBooleanQuery (const std::string &query) const
 
void Save (std::string filename, std::string format="")
 
void Import (std::string url, std::string format="")
 

Detailed Description

Definition at line 33 of file mitkRdfStore.h.

Member Typedef Documentation

typedef std::map<std::string, RdfUri> mitk::RdfStore::PrefixMap

Definition at line 38 of file mitkRdfStore.h.

typedef std::map<std::string, std::list<RdfNode> > mitk::RdfStore::ResultMap

Definition at line 37 of file mitkRdfStore.h.

Constructor & Destructor Documentation

mitk::RdfStore::RdfStore ( )

Construct a new triplestore.

Definition at line 540 of file mitkRdfStore.cpp.

mitk::RdfStore::~RdfStore ( )

Destruct a triplestore.

Definition at line 545 of file mitkRdfStore.cpp.

Member Function Documentation

bool mitk::RdfStore::Add ( RdfTriple  triple)

Add a new triple to the triplestore. Checks if the triplestore contains the triple.

Parameters
tripleA triple.
Returns
If the triple is successfully added or if the triplestore already contains the triple, true will be returned. If none of the previous options happen, false will be returned.

Definition at line 575 of file mitkRdfStore.cpp.

void mitk::RdfStore::AddPrefix ( std::string  prefix,
RdfUri  uri 
)

Add a new prefix which represents an URI as an abbreviation to the triplestore.

Parameters
prefixThe short form of an URI.
uriThe full form of an URI.

Definition at line 560 of file mitkRdfStore.cpp.

void mitk::RdfStore::CleanUp ( )

Clean up the triplestore to the state of a new store.

Definition at line 570 of file mitkRdfStore.cpp.

bool mitk::RdfStore::Contains ( RdfTriple  triple)

Checks if the triplestore contains the triple.

Parameters
tripleA triple.
Returns
If the triplestore contains the triple, true will be returned. Otherwise, false will be returned.

Definition at line 585 of file mitkRdfStore.cpp.

bool mitk::RdfStore::ExecuteBooleanQuery ( const std::string &  query) const

Tests whether or not the specified query pattern has a solution.

Parameters
queryThe SPARQL query string in ASK form.
Returns
True if query pattern has a solution, otherwise false.
Exceptions
mitk::ExceptionThis exception is thrown if one of the following errors occur: (1) failure on query object creation, (2) SPARQL syntax error, (3) trying to execute a non-boolean query, (4) error while retrieving execution result

Definition at line 600 of file mitkRdfStore.cpp.

ResultMap mitk::RdfStore::ExecuteTupleQuery ( const std::string &  query) const

Queries over the triplestore with the given SPARQL query.

Parameters
queryA std:string which stands for a SPARQL query text.
Returns
The result of the query will be returned as a map of keys with their values as lists of nodes.

Definition at line 595 of file mitkRdfStore.cpp.

RdfUri mitk::RdfStore::GetBaseUri ( ) const

Get the base URI of the triplestore.

Definition at line 555 of file mitkRdfStore.cpp.

PrefixMap mitk::RdfStore::GetPrefixes ( ) const

Get a Map with all prefixes of the triplestore.

Returns
A Map with all Prefixes of the RdfStore.

Definition at line 565 of file mitkRdfStore.cpp.

void mitk::RdfStore::Import ( std::string  url,
std::string  format = "" 
)

Imports the state of the triplestore of an URL (URI).

Parameters
filenameA full filepath to the lokal storage or http address as URL. A lokal file path has to look like "file:YOURPATH" ( Example: file:D:/home/readme.txt ).
formatThe current supported formats are: "turtle" (default), "ntriples", "nquads".

Definition at line 610 of file mitkRdfStore.cpp.

ResultMap mitk::RdfStore::Query ( const std::string &  query) const

Queries over the triplestore with the given SPARQL query.

Parameters
queryA std:string which stands for a SPARQL query text.
Returns
The result of the query will be returned as a map of keys with their values as lists of nodes.
Deprecated:
(as of 2016_03) Use mitk::RdfStore::ExecuteTupleQuery() instead.

Definition at line 590 of file mitkRdfStore.cpp.

bool mitk::RdfStore::Remove ( RdfTriple  triple)

Remove a triple from the triplestore. Checks if the triplestore contains the triple.

Parameters
tripleA triple.
Returns
If the triple is successfully removed or if the triplestore doesn't contain the triple, true will be returned. If none of the previous options happen, false will be returned.

Definition at line 580 of file mitkRdfStore.cpp.

void mitk::RdfStore::Save ( std::string  filename,
std::string  format = "" 
)

Saves the current state of the triplestore in a file. The currently supported formats are: "ntriples", "turtle"(default), "nquads".

Parameters
filenameA full filepath to the lokal storage.
formatOne of the supported formats. Default: "turtle".

Definition at line 605 of file mitkRdfStore.cpp.

void mitk::RdfStore::SetBaseUri ( RdfUri  uri)

Set the base URI of the triplestore.

Parameters
uriAn URI which is the base for the triplestore and for new nodes.

Definition at line 550 of file mitkRdfStore.cpp.


The documentation for this class was generated from the following files: