Пример #1
0
def set_places():
    places = json.loads(request.args.get('data'))

    places_file = ''
    for p in place:
        place_name = p['place']
        place_uri = place_name.replace(' ', '-')
        place_loc = p['location']
        places_file += 'aoplace:' + place_uri + '\n\ta foaf:Organization ;\n'
        places_file += '\tfoaf:name "' + place_name + '" ;\n'
        places_file += '\t'

    # add prefixes then send all notes to Fuseki
    insert_peep = set_aop()
    insert_peep += "\n INSERT { %s } WHERE {}" % peep_file
    sparql = SPARQLWrapper(triplestore_url + "/update")
    sparql.setQuery(insert_peep)
    sparql.method = 'POST'

    return jsonify(result=send_places())
Пример #2
0
def set_places():
	places = json.loads(request.args.get('data'))

	places_file = '';
	for p in place:
		place_name = p['place']
		place_uri = place_name.replace(' ', '-')
		place_loc = p['location']
		places_file += 'aoplace:' + place_uri + '\n\ta foaf:Organization ;\n' 
		places_file += '\tfoaf:name "' + place_name + '" ;\n'
		places_file += '\t'
	
	# add prefixes then send all notes to Fuseki
	insert_peep = set_aop()
	insert_peep += "\n INSERT { %s } WHERE {}" %peep_file
	sparql = SPARQLWrapper(triplestore_url + "/update")
	sparql.setQuery(insert_peep) 
	sparql.method = 'POST'

	return jsonify(result=send_places())
Пример #3
0
def set_people():
    people = json.loads(request.args.get('data'))

    peep_file = ''
    for peep in people:
        peep_name = peep['name']
        peep_uri = peep_name.replace(' ', '-')
        peep_email = peep['email']
        peep_file += 'aop:' + peep_uri + '\n\tfoaf:name "' + peep_name + '" '
        if (peep_email != ''):
            peep_file += ';\n\tschema:email "' + peep_email + '" '
        peep_file += '.\n'

    # add prefixes then send all notes to Fuseki
    insert_peep = set_aop()
    insert_peep += "\n INSERT { %s } WHERE {}" % peep_file
    sparql = SPARQLWrapper(triplestore_url + "/update")
    sparql.setQuery(insert_peep)
    sparql.method = 'POST'

    return jsonify(result=peep_file)  #TESTCOMMENT
Пример #4
0
def set_people():
	people = json.loads(request.args.get('data'))

	peep_file = '';
	for peep in people:
		peep_name = peep['name']
		peep_uri = peep_name.replace(' ', '-')
		peep_email = peep['email']
		peep_file += 'aop:' + peep_uri + '\n\tfoaf:name "' + peep_name + '" ' 
		if(peep_email!=''):
			peep_file += ';\n\tschema:email "' + peep_email + '" '
		peep_file += '.\n'
	
	# add prefixes then send all notes to Fuseki
	insert_peep = set_aop()
	insert_peep += "\n INSERT { %s } WHERE {}" %peep_file
	sparql = SPARQLWrapper(triplestore_url + "/update")
	sparql.setQuery(insert_peep) 
	sparql.method = 'POST'

	return jsonify(result=peep_file) #TESTCOMMENT