1 #ifndef HAVE_PERSISTENCE_SERVICE_H
2 #define HAVE_PERSISTENCE_SERVICE_H 1
7 #include <boost/iterator/iterator_facade.hpp>
10 #include "Metadata.hpp"
11 #include "ContentItem.hpp"
13 #include "rdf_model.hpp"
14 #include "rdf_query.hpp"
17 namespace persistence {
21 class content_item_iterator;
45 std::string marmottaServerUrl;
46 std::string contentDirectory;
57 : marmottaServerUrl(
"http://" + serverAddress +
":8080/marmotta")
58 , contentDirectory(
"ftp://mico:mico@" + serverAddress)
59 , metadata(
"http://" + serverAddress +
":8080/marmotta") {};
67 PersistenceService(std::string serverAddress,
int marmottaPort, std::string user, std::string password)
68 : marmottaServerUrl(
"http://" + serverAddress +
":" +
std::to_string(marmottaPort) +
"/marmotta")
69 , contentDirectory(
"ftp://" + user +
":" + password +
"@" + serverAddress)
70 , metadata(
"http://" + serverAddress +
":" +
std::to_string(marmottaPort) +
"/marmotta") {};
80 : marmottaServerUrl(marmottaServerUrl), contentDirectory(contentDirectory), metadata(marmottaServerUrl) {};
126 content_item_iterator begin();
132 content_item_iterator end();
139 #ifndef DOXYGEN_SHOULD_SKIP_THIS
143 class content_item_iterator :
public boost::iterator_facade<content_item_iterator, ContentItem*, boost::forward_traversal_tag, ContentItem*> {
146 const std::string& baseUrl;
147 const std::string& contentDirectory;
151 content_item_iterator(
const std::string& baseUrl,
const std::string& contentDirectory)
152 : pos(-1), baseUrl(baseUrl), contentDirectory(contentDirectory), result(NULL) {};
155 : pos(0), baseUrl(baseUrl), contentDirectory(contentDirectory), result(r) {};
157 ~content_item_iterator() {
if(result) {
delete result; } };
162 friend class boost::iterator_core_access;
165 bool equal(content_item_iterator
const& other)
const;
166 ContentItem* dereference()
const;
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in c...
Definition: http_client.cpp:23
PersistenceService(std::string serverAddress)
Initialise persistence service with the address of a server running the standard installation of the ...
Definition: PersistenceService.hpp:56
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in c...
Main service for accessing the MICO persistence API.
Definition: PersistenceService.hpp:41
PersistenceMetadata & getMetadata()
Get a handle on the overall metadata storage of the persistence service.
Definition: PersistenceService.hpp:89
PersistenceService(std::string marmottaServerUrl, std::string contentDirectory)
Initialise an instance of the PersistenceService using the Marmotta server with the given URL as back...
Definition: PersistenceService.hpp:79
Representation of a ContentItem.
Definition: ContentItem.hpp:76
Definition: rdf_query.hpp:17
PersistenceService(std::string serverAddress, int marmottaPort, std::string user, std::string password)
Initialise persistence service with the address of a server running the standard installation of the ...
Definition: PersistenceService.hpp:67
A URI.
Definition: rdf_model.hpp:74
The result of a SPARQL SELECT query.
Definition: rdf_query.hpp:89