def registerEvent(self, eventDescriptionFile): if self.eventWrapper: eventDescription = EventDescription(open(eventDescriptionFile, "rb")) if not eventDescription.test(): return "Fail", "Invalid EventDescription" self.eventWrapper.registerEvent(eventDescription) return "Ok", "" else: return "Fail", "Event wrapper disabled"
def __init__(self): eventdescription = EventDescription() eventdescription.namespace = "http://ict-citypulse.eu/" eventdescription.graphName = "aarhus_road_traffic_event#" eventdescription.author = "cityofaarhus" eventdescription.timestamp.inField = "ceTime" eventdescription.timestamp.format = "UNIX5" # added after telco with Dan eventdescription.uuid = "0815-0815-0815" eventdescription.location = "POINT (56.45 10.11)" # optional? eventdescription.source = "TODO (Possibly messsage bus grounding?)" eventdescription.eventType = "Aarhus_Road_Traffic_Event" eventdescription.sourceType = "message_bus" eventdescription.sourceFormat = "application/json" eventdescription.information = "Traffic event for the City of Aarhus" """@Daniel P: Now I had time to look a bit closer into your code. I would suggest to make just an example EventDescription to show Dan what we need and to test the annotation part. You will probably need a pseudo EventGenerator for that. Later, the ResourceManagement API will receive new EventDescriptions and instanciate EventWrapper (or best case we can reuse one instance). There is no need to make the metadata file nor to instanciate an EventWrapper for each REPORT_ID.""" self.eventDescription = eventdescription