7.4 Semantic Filtering and Discovery
7.4.1 Introduction
Note
jIn the following descriptions, the general term semantic resource is used to refer to <semanticDescriptor> resources and <contentInstance> resources containing semantic information.
This clause describes semantic discovery procedures on semantic descriptions represented as RDF triples, given that an overall semantic description (logical tree) may be distributed across several semantic resources.
Semantic discovery procedures may be performed using RETRIEVE operations as follows:
Using <semanticFanOutPoint> resource
Targeting any resource other than <semanticFanOutPoint>:
- The receiver begins processing the request by retrieving the <semanticDescriptor> resource of the request target and its descriptor attribute. Related semantic resources are discovered and accessed according to clause 7.4.2 or clause 7.4.3. The content of related descriptor attributes in the case of <semanticDescriptor> resources or content attributes in the case of <contentInstance> resources are added to the content on which the SPARQL request is being executed. Depending on which of the options described in clauses 7.4.2 or 7.4.3 is chosen, all potentially relevant semantic content is added before executing the SPARQL request or they are added when needed during the execution of the SPARQL request.
- The resulting content subject to the SPARQL request is provided to the SPARQL engine for processing.
Targeting a <semanticFanOutPoint> resource (see also clause 10.2.7.12 in oneM2M TS-0001 [1]):
- In this case the related semantic resources are the members of the <group> resource parent of the targeted <semanticFanOutPoint>. Based on the memberID attribute of the parent <group> resource all the related descriptors are discovered, and those on the <group> hosting CSE are retrieved together.
- If there are semantic resources stored on a different CSE, individual RETRIEVE requests are sent to each CSE for retrieving the external resources.
- All semantic resources are retrieved based on the respective access control policies.
- Once all of the related semantic resources have been accessed, the content of each semantic attribute is added to the content on which the SPARQL request is being executed.
- The full/enlarged content subject to the SPARQL request is provided to the SPARQL engine for processing.
Not using <semanticFanOutPoint> resource
Given that an overall semantic description (logical tree) may be distributed across the semantic resources, there are two methods of constructing the logical tree in the scope of a semantic discovery targeting any resource other than <semanticFanOutPoint> :
- If the attribute relatedSemantics is empty or does not exist, the "Annotation-based method" (using resourceDescriptorLink) detailed in clause 7.4.2 shall be used.
- If the attribute relatedSemantics is not empty the "Resource link-based method" (using relatedSemantics) detailed in clause 7.4.3 shall be used.
7.4.2 Annotation-based semantic discovery method
In this option, the links to related <semanticDescriptor> semantic resources are encoded in the semantic description itself, which is encoded as RDF triples [6] logically structured as <subject> <predicate> <object>. For this purpose, an annotation property called onem2m:resourceDescriptorLink is introduced. It is formally specified as part of the oneM2M Base Ontology defined in [7] and can be used as a predicate in any RDF triple with any subject and without further relation to the oneM2M Base Ontology. Only the use of the onem2m namespace is required to uniquely identify the annotation property.
Whenever further information about a semantic instance <X> is stored in another semantic resource, a new RDF triple <X> onem2m:resourceDescriptorLink <ResourceURL> may be added to this semantic description, where <ResourceURL> is the URL of the other semantic resource containing additional information related to <X>. If multiple <semanticDescriptor> resources contain relevant further information, these can be added to a <group> resource and the <ResourceURL> then refers to the virtual <fanOutPoint> resource of this group, which will be used for retrieving the aggregated information.
Note
The RDF triple syntax in this paragraph is only used for illustration purposes. The actual encoding of the RDF triples used in oneM2M is defined in oneM2M TS-0004 [3].
To make use of the onem2m:resourceDescriptorLink property, the evaluation of semantic queries formulated as SPARQL requests by the SPARQL engine has to be adapted in the following way:
- The SPARQL request is executed on the content of the semantic description in the descriptor attribute of the semanticDescriptor resource.
- For each semantic instance matched in the SPARQL request, it is checked whether one or more onem2m:resourceDescriptorLink annotations exist.
- If this is the case, the execution of the SPARQL request is halted.
- The semantic content of the semantic resource referenced by the onem2m:semanticDescriptorLink annotations is added to the content on which the SPARQL request is being executed. If the onem2m:semanticDescriptorLink annotation references a group, the additional semantic content is accessed by performing a retrieve request to the virtual <fanOutPoint> resource referenced.
- The execution of the SPARQL request is continued on the enlarged content.
7.4.3 Resource link-based method
In this option, the links to related semantic resources are specified in the relatedSemantics attribute.
Processing of the SPARQL engine procedures at the receiver :
- The receiver retrieves the <semanticDescriptor> resource of the request target.
-
Based on the relatedSemantics attribute of the <semanticDescriptor> resource targeted, all the related semantic resources are discovered, as follows:
- If the relatedSemantics attribute includes a list of links, each of the linked semantic resources are accessed based on the respective access control policies.
- If the relatedSemantics points to a <group> resource, the group members from the memberID attribute are used and each of them is accessed based on the respective access control policies.
-
Once all of the related semantic resources have been accessed, the content of each of the descriptor attribute is added to the content on which the SPARQL request is being executed.
- The full/enlarged content subject to the SPARQL request is provided to the SPARQL engine for processing.