MICO Platform  1.0.0
 All Classes Namespaces Functions Variables Friends
sparql_client.hpp
1 #ifndef HAVE_SPARQL_CLIENT_H
2 #define HAVE_SPARQL_CLIENT_H 1
3 
4 #include <string>
5 
6 #include "http_client.hpp"
7 #include "rdf_model.hpp"
8 #include "rdf_query.hpp"
9 
10 
11 namespace mico {
12  namespace rdf {
13  namespace query {
14 
15 
16  // thrown when a SPARQL query fails
18  private:
19  long status;
20  std::string message;
21 
22  public:
23  QueryFailedException(long status, std::string message) : status(status), message(message) {};
24 
25  long getStatus() const { return status; };
26 
27  const std::string& getMessage() const { return message; };
28  };
29 
33  class SPARQLClient {
34 
35  private:
36  std::string base_url;
37 
38  mico::http::HTTPClient http_client;
39 
40  public:
41 
42  SPARQLClient(std::string base_url) : base_url(base_url) {};
43 
44 
48  const bool ask(std::string sparqlAsk);
49 
53  const TupleResult* query(std::string sparqlSelect);
54 
55 
59  const void update(std::string sparqlUpdate);
60 
61 
62  };
63 
64 
65  }
66  }
67 }
68 
69 #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
Definition: sparql_client.hpp:17
const void update(std::string sparqlUpdate)
Execute a SPARQL 1.1 Update against the Marmotta server.
Definition: sparql_client.cpp:66
A class allowing to run SPARQL requests against a certain endpoint.
Definition: sparql_client.hpp:33
const TupleResult * query(std::string sparqlSelect)
Execute a SPARQL 1.1 tuple query against the Marmotta server.
Definition: sparql_client.cpp:46
const bool ask(std::string sparqlAsk)
Execute a SPARQL 1.1 ask query against the Marmotta server.
Definition: sparql_client.cpp:26
A simple HTTP client.
Definition: http_client.hpp:198
The result of a SPARQL SELECT query.
Definition: rdf_query.hpp:89