Skip to content
Snippets Groups Projects
Commit 028fa9c9 authored by Cyrille Berger's avatar Cyrille Berger
Browse files

add content type

parent 5031a4a1
No related branches found
No related tags found
No related merge requests found
......@@ -584,7 +584,7 @@ knowCore::ReturnValue<Agent> Agents::createAgent(const knowCore::Uri& _typeUri,
}
}
knowCore::ReturnValue<Stream> Agents::createStream(const knowCore::Uri& _typeUri, const QString& _identifier, const knowCore::Uri& _streamUri)
knowCore::ReturnValue<Stream> Agents::createStream(const knowCore::Uri& _contenttypeUri, const QString& _identifier, const knowCore::Uri& _datatypeUri, const knowCore::Uri& _streamUri)
{
if(isReadOnly())
{
......@@ -595,7 +595,7 @@ knowCore::ReturnValue<Stream> Agents::createStream(const knowCore::Uri& _typeUri
{
return kCrvLogError("Failed to create stream {}, it is already added to a graph.", _streamUri);
}
Queries::Agents::StreamInsert::Results r = Queries::Agents::StreamInsert::execute(d->connection, d->definition->uri, _streamUri, _identifier, _typeUri);
Queries::Agents::StreamInsert::Results r = Queries::Agents::StreamInsert::execute(d->connection, d->definition->uri, _streamUri, _identifier, _contenttypeUri, _datatypeUri);
if(r.success)
{
return stream(_streamUri);
......
......@@ -112,7 +112,7 @@ namespace kDBRobotics
/**
* Create a new \ref Stream of uri type \p _typeUri with name \p _name and add it to this agent graph.
*/
knowCore::ReturnValue<Stream> createStream(const knowCore::Uri& _typeUri, const QString& _identifier, const knowCore::Uri& _streamUri = knowCore::Uri::createUnique({"stream"}));
knowCore::ReturnValue<Stream> createStream(const knowCore::Uri& _contentTypeUri, const QString& _identifier, const knowCore::Uri& _dataTypeUri, const knowCore::Uri& _streamUri = knowCore::Uri::createUnique({"stream"}));
private:
struct Private;
QExplicitlySharedDataPointer<Private> d;
......
......@@ -34,6 +34,11 @@ knowCore::Uri Stream::datatype() const
return d->definition->datatype;
}
knowCore::Uri Stream::contentType() const
{
return d->definition->contentType;
}
knowCore::ReturnValue<bool> Stream::hasProperty(const knowCore::Uri& _property) const
{
return d->object.hasProperty(_property);
......
......@@ -17,6 +17,7 @@ namespace kDBRobotics
knowCore::Uri uri() const;
QString identifier() const;
knowCore::Uri datatype() const;
knowCore::Uri contentType() const;
/**
* @return if the given property is set
*/
......
......@@ -15,7 +15,7 @@ namespace kDBRobotics
struct Definition
{
QMutex mutex;
knowCore::Uri uri, datatype;
knowCore::Uri uri, datatype, contentType;
QString identifier;
knowCore::Uri triplestores;
QList<knowCore::Uri> resources_with_stream;
......
......@@ -111,6 +111,7 @@ INSERT DATA {
GRAPH %graph {
%stream_uri a askcore_stream:stream ;
askcore_stream:identifier %identifier ;
askcore_stream:contenttype %contenttype ;
askcore_stream:datatype %datatype .
}
}
......@@ -118,7 +119,8 @@ INSERT DATA {
askcore_queries:binding [ foaf:name "graph" ; xsi:type xsd:anyURI ; dc:description "URI for the graph where to insert this agent" ] ;
askcore_queries:binding [ foaf:name "stream_uri" ; xsi:type xsd:anyURI ; dc:description "Uri of the stream" ] ;
askcore_queries:binding [ foaf:name "identifier" ; xsi:type xsd:string ; dc:description "Identifier of the stream (e.g. could be a topic name)" ] ;
askcore_queries:binding [ foaf:name "datatype" ; xsi:type xsd:anyURI ; dc:description "Uri of the datatype" ] ;
askcore_queries:binding [ foaf:name "contenttype" ; xsi:type xsd:anyURI ; dc:description "Uri of the content type" ] ;
askcore_queries:binding [ foaf:name "datatype" ; xsi:type xsd:anyURI ; dc:description "Uri of the data type" ] ;
askcore_queries:graph "%graph"
.
......@@ -137,13 +139,15 @@ ASK { GRAPH %graph { %stream_uri a askcore_stream:stream } }""" ;
foaf:name "stream_select" ;
askcore_queries:query """PREFIX askcore_stream: <http://askco.re/stream#>
SELECT ?datatype ?identifier FROM %graph WHERE {
SELECT ?datatype ?identifier ?contenttype FROM %graph WHERE {
%stream_uri a askcore_stream:stream ;
askcore_stream:datatype ?datatype ;
askcore_stream:contenttype ?contenttype ;
askcore_stream:identifier ?identifier .
}""" ;
askcore_queries:binding [ foaf:name "graph" ; xsi:type xsd:anyURI ; dc:description "URI for the graph where to get all the agents." ] ;
askcore_queries:binding [ foaf:name "stream_uri" ; xsi:type xsd:anyURI ; dc:description "Uri of the stream" ] ;
askcore_queries:result [ foaf:name "contenttype" ; xsi:type xsd:anyURI ; dc:description "contenttype of stream" ] ;
askcore_queries:result [ foaf:name "datatype" ; xsi:type xsd:anyURI ; dc:description "Datatype of stream" ] ;
askcore_queries:result [ foaf:name "identifier" ; xsi:type xsd:string ; dc:description "Identifier of agent" ] ;
askcore_queries:graph "%graph" .
......@@ -152,13 +156,15 @@ SELECT ?datatype ?identifier FROM %graph WHERE {
foaf:name "stream_select_all" ;
askcore_queries:query """PREFIX askcore_stream: <http://askco.re/stream#>
SELECT ?stream_uri ?datatype ?identifier FROM %graph WHERE {
SELECT ?stream_uri ?datatype ?identifier ?contenttype FROM %graph WHERE {
?stream_uri a askcore_stream:stream ;
askcore_stream:datatype ?datatype ;
askcore_stream:contenttype ?contenttype ;
askcore_stream:identifier ?identifier .
}""" ;
askcore_queries:binding [ foaf:name "graph" ; xsi:type xsd:anyURI ; dc:description "URI for the graph where to get all the agents." ] ;
askcore_queries:result [ foaf:name "stream_uri" ; xsi:type xsd:anyURI ; dc:description "Uri of the stream" ] ;
askcore_queries:result [ foaf:name "stream_uri" ; xsi:type xsd:anyURI ; dc:description "Uri of the stream" ] ;
askcore_queries:result [ foaf:name "contenttype" ; xsi:type xsd:anyURI ; dc:description "contenttype of stream" ] ;
askcore_queries:result [ foaf:name "datatype" ; xsi:type xsd:anyURI ; dc:description "Datatype of stream" ] ;
askcore_queries:result [ foaf:name "identifier" ; xsi:type xsd:string ; dc:description "Identifier of agent" ] ;
askcore_queries:graph "%graph" .
......@@ -167,15 +173,17 @@ SELECT ?stream_uri ?datatype ?identifier FROM %graph WHERE {
foaf:name "stream_select_all_for" ;
askcore_queries:query """PREFIX askcore_stream: <http://askco.re/stream#>
SELECT ?stream_uri ?datatype ?identifier FROM %graph WHERE {
SELECT ?stream_uri ?datatype ?identifier ?contenttype FROM %graph WHERE {
%resource_uri askcore_stream:has_stream ?stream_uri .
?stream_uri a askcore_stream:stream ;
askcore_stream:datatype ?datatype ;
askcore_stream:contenttype ?contenttype ;
askcore_stream:identifier ?identifier .
}""" ;
askcore_queries:binding [ foaf:name "graph" ; xsi:type xsd:anyURI ; dc:description "URI for the graph where to get all the agents." ] ;
askcore_queries:binding [ foaf:name "resource_uri" ; xsi:type xsd:anyURI ; dc:description "Uri of the resource" ] ;
askcore_queries:result [ foaf:name "stream_uri" ; xsi:type xsd:anyURI ; dc:description "Uri of the stream" ] ;
askcore_queries:binding [ foaf:name "resource_uri"; xsi:type xsd:anyURI ; dc:description "Uri of the resource" ] ;
askcore_queries:result [ foaf:name "stream_uri" ; xsi:type xsd:anyURI ; dc:description "Uri of the stream" ] ;
askcore_queries:result [ foaf:name "contenttype" ; xsi:type xsd:anyURI ; dc:description "contenttype of stream" ] ;
askcore_queries:result [ foaf:name "datatype" ; xsi:type xsd:anyURI ; dc:description "Datatype of stream" ] ;
askcore_queries:result [ foaf:name "identifier" ; xsi:type xsd:string ; dc:description "Identifier of agent" ] ;
askcore_queries:graph "%graph" .
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment