widget = [] for i in range(rd.randint(3, 7)): field = {} field[names["syntacticType"]] = "text" field[names["semanticType"]] = rd.choice(semanticTypes) field[names["flow"]] = rd.choice(types) field[names["name"]] = next(ug) widget.append(field) return widget if __name__ == "__main__": ug = uriGenerator() base = "http://linkeddata4.dia.fi.upm.es:8080/MatcherService/rest/semanticmatcher/matchingsSpace/" id = "matcherCallTest" printf(jsonCall("DELETE", base + id)) printf(jsonCall("PUT", base + id)) printf(jsonCall("GET", base + id)) names = {"flow": "flow", "semanticType": "semanticType", "name": "id", "syntacticType": "syntacticType"} posts = [] gets = [] # This should NOT be this way: printf( jsonCall( "POST", base + id, data={ "ontologies": ["https://raw.github.com/jmora/snippets/master/java/relationCheck/resources/flights.owl"], "type": "addition", "fields": [], },
def generateWidget(ug, names): semanticTypes = ['account', 'creditCard', 'person', 'e-mail'] types = ['input', 'output'] widget = [] for i in range(rd.randint(3,7)): field = {} field[names['syntacticType']] = 'text' field[names['semanticType']] = rd.choice(semanticTypes) field[names['flow']] = rd.choice(types) field[names['name']] = next(ug) widget.append(field) return widget if __name__ == "__main__": ug = uriGenerator() base = "http://linkeddata4.dia.fi.upm.es:8080/MatcherService/rest/matcher/matchingsSpace/" id = "matcherCallTest" printf(jsonCall('PUT', base+id)) printf(jsonCall('GET', base+id)) names = {'flow':'flow', 'semanticType':'semanticType', 'name':'id', 'syntacticType':'syntacticType'} for i in range(10): #data = {'ontologies': [], 'operation':'addition', 'fields':generateWidget(ug, names)} data = {'ontologies': [], 'type':'addition', 'fields':generateWidget(ug, names)} printf(jsonCall('POST', base+id, data)) printf(jsonCall('GET', base+id))