1 #ifndef HAVE_CONTENTITEM_H
2 #define HAVE_CONTENTITEM_H 1
7 #include <boost/uuid/uuid.hpp>
8 #include <boost/uuid/uuid_io.hpp>
9 #include <boost/iterator/iterator_facade.hpp>
11 #include "Content.hpp"
12 #include "Metadata.hpp"
14 #include "rdf_model.hpp"
15 #include "rdf_query.hpp"
18 namespace persistence {
63 class content_part_iterator;
66 const std::string SUFFIX_METADATA =
"-metadata";
67 const std::string SUFFIX_EXECUTION =
"-execution";
68 const std::string SUFFIX_RESULT =
"-result";
81 const std::string& baseUrl;
82 const std::string& contentDirectory;
83 boost::uuids::uuid id;
97 ContentItem(
const std::string& baseUrl,
const std::string& contentDirectory,
const boost::uuids::uuid&
id);
200 content_part_iterator
begin();
206 content_part_iterator
end();
212 #ifndef DOXYGEN_SHOULD_SKIP_THIS
217 class content_part_iterator :
public boost::iterator_facade<content_part_iterator, Content*, boost::forward_traversal_tag, Content*> {
221 const std::string& baseUrl;
222 const std::string& contentDirectory;
226 content_part_iterator(ContentItem& item,
const std::string& baseUrl,
const std::string& contentDirectory)
227 : pos(-1), item(item), baseUrl(baseUrl), contentDirectory(contentDirectory), result(NULL) {}
229 content_part_iterator(ContentItem& item,
const std::string& baseUrl,
const std::string& contentDirectory,
const mico::rdf::query::TupleResult* r)
230 : pos(0), item(item), baseUrl(baseUrl), contentDirectory(contentDirectory), result(r) {}
232 ~content_part_iterator() {
if(result) {
delete result; } }
237 friend class boost::iterator_core_access;
240 bool equal(content_part_iterator
const& other)
const;
241 Content* dereference()
const;
246 inline bool operator==(
const ContentItem& ci1,
const ContentItem& ci2) {
247 return ci1.baseUrl == ci2.baseUrl && ci1.id == ci2.id;
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in c...
Definition: http_client.cpp:23
Content * createContentPart()
Create a new content part with a random URI and return a handle.
Definition: ContentItem.cpp:76
ContentItemMetadata & getMetadata()
Return (read-only) content item metadata part of the initial content item, e.g.
Definition: ContentItem.hpp:131
ExecutionMetadata & getExecution()
Return execution plan and metadata (e.g.
Definition: ContentItem.hpp:141
const mico::rdf::model::URI getURI() const
Return the identifier (a unique URI) for this content item.
Definition: ContentItem.hpp:121
content_part_iterator end()
Return the end iterator for content parts.
Definition: ContentItem.cpp:188
std::string getBaseUrl() const
Return the (base URL) used by this content item.
Definition: ContentItem.hpp:113
Definition: Content.hpp:20
Content * operator[](const mico::rdf::model::URI &id)
Convenient C++ style operator for accessing and constructing content parts.
Definition: ContentItem.cpp:158
Representation of a ContentItem.
Definition: ContentItem.hpp:76
ContentItem(const std::string &baseUrl, const std::string &contentDirectory, const boost::uuids::uuid &id)
Create a new content item using the given server base URL and a unique UUID as content item identifie...
Content * getContentPart(const mico::rdf::model::URI &id)
Return a handle to the ContentPart with the given URI, or null in case the content item does not have...
Definition: ContentItem.cpp:118
A URI.
Definition: rdf_model.hpp:74
The result of a SPARQL SELECT query.
Definition: rdf_query.hpp:89
void deleteContentPart(const mico::rdf::model::URI &id)
Remove the content part with the given URI in case it exists and is a part of this content item...
Definition: ContentItem.cpp:138
content_part_iterator begin()
Return an iterator over all content parts contained in this content item.
Definition: ContentItem.cpp:173
Specialised support for content item metadata of content item processing.
Definition: ContentItem.hpp:25
ResultMetadata & getResult()
Return the current state of the analysis result (as RDF metadata).
Definition: ContentItem.hpp:149