A class offering access to RDF metadata through SPARQL. More...
#include <Metadata.hpp>
Public Member Functions | |
Metadata (std::string baseUrl) | |
Create a new metadata object for the given server using the global SPARQL endpoint. More... | |
Metadata (std::string baseUrl, std::string context) | |
Create a new metadata object for the given server base URL and context using the contextual SPARQL endpoint. More... | |
void | load (std::istream &in, const std::string format) |
Load RDF data of the given format into the metadata dataset. More... | |
void | dump (std::ostream &out, const std::string format) |
Dump the RDF data contained in the metadata dataset into the given output stream using the given serialization format. More... | |
void | update (const std::string sparqlUpdate) |
Execute a SPARQL update query on the metadata (see http://www.w3.org/TR/sparql11-update/). More... | |
const mico::rdf::query::TupleResult * | query (const std::string sparqlQuery) |
Execute a SPARQL SELECT query on the metadata (see http://www.w3.org/TR/sparql11-query/). More... | |
const bool | ask (const std::string sparqlQuery) |
Execute a SPARQL ASK query on the metadata (see http://www.w3.org/TR/sparql11-query/). More... | |
void | close () |
Close the metadata connection and clean up any open resources. | |
Protected Attributes | |
std::string | baseUrl |
the base URL of the server | |
std::string | contextUrl |
the URI of the context to use as named graph | |
mico::rdf::query::SPARQLClient | sparqlClient |
an instance of a SPARQL client, will be initialised to baseUrl + "/sparql" | |
mico::http::HTTPClient | httpClient |
an instance of an HTTP client, will be used for load/dump More... | |
A class offering access to RDF metadata through SPARQL.
The Metadata class implements a wrapper around a SPARQL endpoint and can be used for any kind of RDF metadata representation. Together with a contextual Marmotta server, it is also context aware, i.e. when the ID of a named graph has been configured, all operations will only be executed on this graph.
mico::persistence::Metadata::Metadata | ( | std::string | baseUrl | ) |
Create a new metadata object for the given server using the global SPARQL endpoint.
Optional context must be given explicitly in SPARQL queries.
mico::persistence::Metadata::Metadata | ( | std::string | baseUrl, |
std::string | context | ||
) |
Create a new metadata object for the given server base URL and context using the contextual SPARQL endpoint.
All queries and updates will exclusively access this context.
const bool mico::persistence::Metadata::ask | ( | const std::string | sparqlQuery | ) |
Execute a SPARQL ASK query on the metadata (see http://www.w3.org/TR/sparql11-query/).
This method can be used for any kind of data access.
sparqlQuery |
void mico::persistence::Metadata::dump | ( | std::ostream & | out, |
const std::string | format | ||
) |
Dump the RDF data contained in the metadata dataset into the given output stream using the given serialization format.
Can be used for exporting the metadata.
out | OutputStream to export the data to |
format | data format the RDF data is using (e.g. (e.g. text/turtle or application/rdf+xml; defined shortcuts: "turtle" and "rdfxml") |
Can be used for exporting the metadata.
out | OutputStream to export the data to |
format | data format the RDF data is using (e.g. Turtle) |
void mico::persistence::Metadata::load | ( | std::istream & | in, |
const std::string | format | ||
) |
Load RDF data of the given format into the metadata dataset.
Can be used for preloading existing metadata.
in | InputStream to load the data from |
format | data format the RDF data is using (e.g. text/turtle or application/rdf+xml; defined shortcuts: "turtle" and "rdfxml") |
Can be used for preloading existing metadata.
in | InputStream to load the data from |
format | data format the RDF data is using (e.g. Turtle) |
const TupleResult * mico::persistence::Metadata::query | ( | const std::string | sparqlQuery | ) |
Execute a SPARQL SELECT query on the metadata (see http://www.w3.org/TR/sparql11-query/).
This method can be used for any kind of data access.
sparqlQuery |
void mico::persistence::Metadata::update | ( | const std::string | sparqlUpdate | ) |
Execute a SPARQL update query on the metadata (see http://www.w3.org/TR/sparql11-update/).
This method can be used for any kind of modification of the data.
sparqlUpdate |
|
protected |
an instance of an HTTP client, will be used for load/dump
using the baseUrl and the Marmotta import/export endpoints