コード例 #1
0
                            '"', '\"').replace('\n', '\\n')
                        # turn it into a string
                        attribute_value[
                            'value'] = value_of_the_geo_property_as_escaped_string
                    except Exception:
                        print("GeoProperty malformed? no value field??: " +
                              entity['id'])
            except Exception:
                print("entity malformed? no type field??: " + entity['id'])

    # lets now push the entity to the Broker
    try:
        response = F4Ingsild.append_or_create_entity(brokerurl, entity)
        return True
    except Exception:
        traceback.print_exc()
        print("Exception while REST POST of Entity " + entity['id'])

    return False


############# END Scorpio Functions ############

# Lets tell the common module who we are, so that it can import us,
# and programmatically bind the above functions, specifically implemented
# with the same signature by each silo controller.
# Use the following dot notation if we are in a different folder than the common_vsilo_functionality
#common.start_silo_controller("scorpio-flavour.scorpio_silo_controller")
# Otherwise just give our name
common.start_silo_controller("scorpio_silo_controller")
コード例 #2
0

# Here we receive a data item, which is composed of "data" and "meta" fields
def add_entity_under_vThing_on_Broker(v_thing_id, entity):
    # lets add the vThingID as a property into each entity
    entity['generatedByVThing'] = {
        'type': 'Relationship',
        'object': v_thing_id.replace("/", ":")
    }

    # lets now push the entity to the Broker
    try:
        response = F4Ingsild.append_or_create_entity(brokerurl, entity)
        return True
    except Exception:
        traceback.print_exc()
        print("Exception while REST POST of Entity " + entity['id'])

    return False


############# END Stellio Functions ############

# Lets tell the common module who we are, so that it can import us,
# and programmatically bind the above functions, specifically implemented
# with the same signature by each silo controller.
# Use the following dot notation if we are in a different folder than the common_vsilo_functionality
#common.start_silo_controller("stellio-flavour.stellio_silo_controller")
# Otherwise just give our name
common.start_silo_controller("stellio_silo_controller")
コード例 #3
0
    #           value_of_the_geo_property_as_escaped_string = value_of_the_geo_property_as_string.replace('"', '\"').replace('\n', '\\n')
    #           # turn it into a string
    #           attribute_value['value'] = value_of_the_geo_property_as_escaped_string
    #         except Exception:
    #           print("GeoProperty malformed? no value field??: " + entity['id'])
    #     except Exception:
    #       print("entity malformed? no type field??: " + entity['id'])

    # lets now push the entity to the Broker
    try:
      response = F4Ingsild.append_or_create_entity(brokerurl, entity)
      return True
    except Exception:
      traceback.print_exc()
      print("Exception while REST POST of Entity " + entity['id'])
    
    return False

############# END NGSI-LD Functions ############


# Lets tell the common module who we are, so that it can import us,
# and programmatically bind the above functions, specifically implemented
# with the same signature by each silo controller.
# Use the following dot notation if we are in a different folder than the common_vsilo_functionality
#common.start_silo_controller("ngsild-flavour.ngsild_silo_controller")
# Otherwise just give our name
common.start_silo_controller("ngsild_silo_controller")