<jupyter_start><jupyter_text>oneM2M - GroupsThis notebook demonstrates how oneM2M resources can be organized into groups. &lt;Group> resources offer a so-called *fan-out point* that can be the target to address all resources of a group.- Create a second &lt;Container resource- Create a &lt;Group> resource with &lt;Container> resources- Add a &lt;ContentInstance> to the &lt;Group>'s containers IntitializationThe section does import necessary modules and configurations.<jupyter_code>%run init.py<jupyter_output><empty_output><jupyter_text>Create a second &lt;Container> ResourceFirst, we create a second &lt;Container> resource.<jupyter_code>CREATE (                                           # CREATE request
    url + '/Notebook-AE',
    
    # Request Headers
    {
        'X-M2M-Origin' : originator,               # Set the originator
        'X-M2M-RI'     : '0',                      # Request identifier
        'Accept'       : 'application/json',       # Response shall be JSON
        'Content-Type' : 'application/json;ty=3'   # Content is JSON, and represents an <Container> resource
    },
    
    # Request Body
    {
        "m2m:cnt": {
            "rn":"Container_2"
        }
    }
)<jupyter_output><empty_output><jupyter_text>Create a &lt;Group> ResourceHere, we create a &lt;Group> resource with the two &lt;Container> resources as components.- **mid** : Member IDs, this is a list of resource IDs of resources that will belong to the &lt;Group>. - **mnm** : The maximum number of member of a &lt;Group>.Note, that a &lt;Group> may contain resources of mixed type. Requests to the &lt;Group>'s fan-out point in general only affect fitting resources.<jupyter_code>CREATE (                                           # CREATE request
    url + '/Notebook-AE',
    
    # Request Headers
    {
        'X-M2M-Origin' : originator,               # Set the originator
        'X-M2M-RI'     : '0',                      # Request identifier
        'Accept'       : 'application/json',       # Response shall be JSON
        'Content-Type' : 'application/json;ty=9'   # Content is JSON, and represents an <Group> resource
    },
    
    # Request Body
    '''
    {
        "m2m:grp": {
            "rn": "Group",
            "mid": [ "%s/Notebook-AE/Container", "%s/Notebook-AE/Container_2" ],
            "mnm": 10
        }
    }
    ''' % (basename, basename)
)<jupyter_output><empty_output><jupyter_text>The response introduces some new attributes:- **mt** : Member type. This is the resource type of the member resources. The member type is *mixed" in case the member resourtces are not all of the same type.- **cnm** : The current number of member of the &lt;Group> resource.- **mtv** : Member types validated. This read-only attribute indicates whether the hosting CSE validated the member resources.- **csy** : The consistency strategy determines how the CSE deals with the &lt;Group> resource if the member type validation fails.- **fopt** : The fan-out point is a virtual resource created by the CSE. It acts as a target for requests to the members of a &lt;Group> resource. Add a &lt;ContentInstance> Resource to all &lt;Group> ResourcesThe following request creates multiple &lt;ContentInstances> resources, one under each member of the &lt;Group> resource.<jupyter_code>CREATE (                                            # CREATE request
    url + '/Notebook-AE/Group/fopt',
    
    # Request Headers
    {
        'X-M2M-Origin' : originator,               # Set the originator
        'X-M2M-RI'     : '0',                      # Request identifier
        'Accept'       : 'application/json',       # Response shall be JSON
        'Content-Type' : 'application/json;ty=4'   # Content is JSON, and represents an <ContentInstance> resource
    },
    
    # Request Body
    {
        "m2m:cin": {
            "cnf": "text/plain:0",
            "con": "Hello, World!"
        }
    }
)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10624841892233747, 'fraction_numerical': 0.005565393372122439, 'mean_word_length': 2.450261780104712, 'pattern_counts': {'":': 9, '<': 20, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '109698', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1094, 'n_words': 379, 'path': 'onem2m-04-groups.ipynb', 'repo_name': 'lovele0107/oneM2M-jupyter', 'size': '3953'}