MICO Platform  1.0.0
 All Classes Namespaces Functions Variables Friends
Public Member Functions | Protected Attributes | Friends | List of all members
mico::persistence::ContentItem Class Reference

Representation of a ContentItem. More...

#include <ContentItem.hpp>

Public Member Functions

 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 identifier. More...
 
 ContentItem (const std::string &baseUrl, const std::string &contentDirectory, const mico::rdf::model::URI &uri)
 Create a new content item using the given server base URL and a URI as content item identifier. More...
 
const mico::rdf::model::URI getURI () const
 Return the identifier (a unique URI) for this content item. More...
 
ContentItemMetadatagetMetadata ()
 Return (read-only) content item metadata part of the initial content item, e.g. More...
 
ExecutionMetadatagetExecution ()
 Return execution plan and metadata (e.g. More...
 
ResultMetadatagetResult ()
 Return the current state of the analysis result (as RDF metadata). More...
 
ContentcreateContentPart ()
 Create a new content part with a random URI and return a handle. More...
 
ContentcreateContentPart (const mico::rdf::model::URI &id)
 Create a new content part with the given URI and return a handle. More...
 
ContentgetContentPart (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 this content part. More...
 
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. More...
 
Contentoperator[] (const mico::rdf::model::URI &id)
 Convenient C++ style operator for accessing and constructing content parts. More...
 
content_part_iterator begin ()
 Return an iterator over all content parts contained in this content item. More...
 
content_part_iterator end ()
 Return the end iterator for content parts. More...
 

Protected Attributes

const std::string & baseUrl
 
const std::string & contentDirectory
 
boost::uuids::uuid id
 
ContentItemMetadata metadata
 
ExecutionMetadata execution
 
ResultMetadata result
 

Friends

bool operator== (const ContentItem &ci1, const ContentItem &ci2)
 

Detailed Description

Representation of a ContentItem.

A ContentItem is a collection of ContentParts, e.g. an HTML page together with its embedded images. ContentParts can be either original content or created during analysis.

Author
Sebastian Schaffert (sscha.nosp@m.ffer.nosp@m.t@apa.nosp@m.che..nosp@m.org)

Constructor & Destructor Documentation

mico::persistence::ContentItem::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 identifier.

The URI of the content item will be composed of the base URL and the id.

Parameters
baseUrlbase URL of the marmotta server
ida unique UUID identifying the content item
mico::persistence::ContentItem::ContentItem ( const std::string &  baseUrl,
const std::string &  contentDirectory,
const mico::rdf::model::URI uri 
)

Create a new content item using the given server base URL and a URI as content item identifier.

The base URL must be a prefix of the URI of the content item.

Parameters
baseUrlbase URL of the marmotta server
uria unique URI identifying the content item (must have baseUrl as prefix)

Member Function Documentation

content_part_iterator mico::persistence::ContentItem::begin ( )

Return an iterator over all content parts contained in this content item.

Returns
an iterable that (lazily) iterates over the content parts
Content * mico::persistence::ContentItem::createContentPart ( )

Create a new content part with a random URI and return a handle.

The handle can then be used for updating the content and metadata of the content part.

Returns
a handle to a ContentPart object that is suitable for reading and updating
Content * mico::persistence::ContentItem::createContentPart ( const mico::rdf::model::URI id)

Create a new content part with the given URI and return a handle.

The handle can then be used for updating the content and metadata of the content part.

Parameters
idthe URI of the content part to create
Returns
a handle to a ContentPart object that is suitable for reading and updating
void mico::persistence::ContentItem::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.

Otherwise do nothing.

Parameters
idthe URI of the content part to delete
content_part_iterator mico::persistence::ContentItem::end ( )

Return the end iterator for content parts.

Can be used to check when iteration is completed.

Content * mico::persistence::ContentItem::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 this content part.

Parameters
idthe URI of the content part to return
Returns
a handle to a ContentPart object that is suitable for reading and updating
ExecutionMetadata& mico::persistence::ContentItem::getExecution ( )
inline

Return execution plan and metadata (e.g.

dependencies, profiling information, execution information). Can be updated by other components to add their execution information.

TODO: could return a specialised Metadata object once we know the schema for execution metadata

Returns
a handle to a Metadata object that is suitable for reading and updating
ContentItemMetadata& mico::persistence::ContentItem::getMetadata ( )
inline

Return (read-only) content item metadata part of the initial content item, e.g.

provenance information etc.

TODO: could return a specialised Metadata object with fast access to commonly used properties once we know the schema

Returns
a handle to a Metadata object that is suitable for reading
ResultMetadata& mico::persistence::ContentItem::getResult ( )
inline

Return the current state of the analysis result (as RDF metadata).

Can be updated by other components to extend the result with new information. This will hold the final analysis results.

Returns
a handle to a Metadata object that is suitable for reading and updating
const mico::rdf::model::URI mico::persistence::ContentItem::getURI ( ) const
inline

Return the identifier (a unique URI) for this content item.

Returns
the URI identifying this content item
Content * mico::persistence::ContentItem::operator[] ( const mico::rdf::model::URI id)

Convenient C++ style operator for accessing and constructing content parts.

Returns the content part with the given ID if found or a newly created content part if not found.


The documentation for this class was generated from the following files: