MICO Platform
 All Classes Namespaces Functions Variables Friends
Metadata.hpp
1 #ifndef HAVE_METADATA_H
2 #define HAVE_METADATA_H 1
3 
4 #include <string>
5 #include <iostream>
6 
7 #include "http_client.hpp"
8 #include "sparql_client.hpp"
9 
10 namespace mico {
11  // forward declarations
12  namespace rdf {
13  namespace query {
14  class TupleResult;
15  }
16  }
17 
18  namespace persistence {
19 
20 
28  class Metadata {
29 
30  protected:
31  std::string baseUrl;
32  std::string contextUrl;
33 
36 
39 
41  public:
42 
47  Metadata(std::string baseUrl);
48 
53  Metadata(std::string baseUrl, std::string context);
54 
55 
63  void load(std::istream& in, const std::string format);
64 
65 
74  void dump(std::ostream& out, const std::string format);
75 
76 
77 
84  void update(const std::string sparqlUpdate);
85 
86 
94  const mico::rdf::query::TupleResult* query(const std::string sparqlQuery);
95 
96 
97 
105  const bool ask(const std::string sparqlQuery);
106 
107 
111  void close() {};
112 
113  };
114  }
115 }
116 
117 #endif
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in c...
Definition: http_client.cpp:23
std::string contextUrl
the URI of the context to use as named graph
Definition: Metadata.hpp:32
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 seri...
Definition: Metadata.cpp:93
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/).
Definition: Metadata.cpp:135
void update(const std::string sparqlUpdate)
Execute a SPARQL update query on the metadata (see http://www.w3.org/TR/sparql11-update/).
Definition: Metadata.cpp:123
A class allowing to run SPARQL requests against a certain endpoint.
Definition: sparql_client.hpp:33
mico::http::HTTPClient httpClient
an instance of an HTTP client, will be used for load/dump
Definition: Metadata.hpp:38
A class offering access to RDF metadata through SPARQL.
Definition: Metadata.hpp:28
std::string baseUrl
the base URL of the server
Definition: Metadata.hpp:31
A simple HTTP client.
Definition: http_client.hpp:198
The result of a SPARQL SELECT query.
Definition: rdf_query.hpp:89
void close()
Close the metadata connection and clean up any open resources.
Definition: Metadata.hpp:111
void load(std::istream &in, const std::string format)
Load RDF data of the given format into the metadata dataset.
Definition: Metadata.cpp:61
const bool ask(const std::string sparqlQuery)
Execute a SPARQL ASK query on the metadata (see http://www.w3.org/TR/sparql11-query/).
Definition: Metadata.cpp:148
mico::rdf::query::SPARQLClient sparqlClient
an instance of a SPARQL client, will be initialised to baseUrl + "/sparql"
Definition: Metadata.hpp:35
Metadata(std::string baseUrl)
Create a new metadata object for the given server using the global SPARQL endpoint.
Definition: Metadata.cpp:39