def change_date(schema_uri, date_type, date_value, virtuoso_graph, local_sparql, virtuoso_user, virtuoso_pass): """ """ deldate_query = (sq.DELETE_SCHEMA_DATE.format(virtuoso_graph, schema_uri, date_type)) deldate_result = aux.send_data(deldate_query, local_sparql, virtuoso_user, virtuoso_pass) insdate_query = (sq.INSERT_SCHEMA_DATE.format(virtuoso_graph, schema_uri, date_type, date_value)) insdate_result = aux.send_data(insdate_query, local_sparql, virtuoso_user, virtuoso_pass)
def change_lock(schema_uri, action, virtuoso_graph, local_sparql, virtuoso_user, virtuoso_pass): """ """ del_lock_query = (sq.DELETE_SCHEMA_LOCK.format(virtuoso_graph, schema_uri)) del_lock_result = aux.send_data(del_lock_query, local_sparql, virtuoso_user, virtuoso_pass) # insert new value add_lock_query = (sq.INSERT_SCHEMA_LOCK.format(virtuoso_graph, schema_uri, action)) add_lock_result = aux.send_data(add_lock_query, local_sparql, virtuoso_user, virtuoso_pass)
def single_delete(statement, uris, virtuoso_graph, local_sparql, virtuoso_user, virtuoso_pass): """ """ query = (statement.format(virtuoso_graph, *uris)) result = aux.send_data(query, local_sparql, virtuoso_user, virtuoso_pass) return [result.status_code, result.text]
def change_date(schema_uri, date_type, date_value, virtuoso_graph, local_sparql, virtuoso_user, virtuoso_pass): """ Changes the last modification date or date of insertion of a schema. Parameters ---------- schema_uri : str The URI of the schema in the Chewie-NS. date_type : str The type of the date to change, 'dateEntered' or 'last_modified'. date_value : str The new date, in the format YYYY-MM-DDTHH:MM:SS.f. Returns ------- True if the action is performed successfully, False and request response object otherwise. """ deldate_query = (sq.DELETE_SCHEMA_DATE.format(virtuoso_graph, schema_uri, date_type)) deldate_result = aux.send_data(deldate_query, local_sparql, virtuoso_user, virtuoso_pass) del_status = deldate_result.status_code if del_status > 201: return [False, deldate_result.content] else: insdate_query = (sq.INSERT_SCHEMA_DATE.format(virtuoso_graph, schema_uri, date_type, date_value)) insdate_result = aux.send_data(insdate_query, local_sparql, virtuoso_user, virtuoso_pass) ins_status = insdate_result.status_code if ins_status > 201: return [False, insdate_result.content] else: return True
def change_lock(schema_uri, action, virtuoso_graph, local_sparql, virtuoso_user, virtuoso_pass): """ Changes the locking state of a schema in the Chewie-NS. Parameters ---------- schema_uri : str The URI of the schema in the Chewie-NS. action : str 'LOCKED' if the schema should be locked or 'Unlocked' if it should be unlocked. Returns ------- True if the action is performed successfully, False otherwise. """ del_lock_query = (sq.DELETE_SCHEMA_LOCK.format(virtuoso_graph, schema_uri)) del_lock_result = aux.send_data(del_lock_query, local_sparql, virtuoso_user, virtuoso_pass) del_status = del_lock_result.status_code if del_status > 201: return [False, del_lock_result.content] else: # insert new locking value add_lock_query = (sq.INSERT_SCHEMA_LOCK.format(virtuoso_graph, schema_uri, action)) add_lock_result = aux.send_data(add_lock_query, local_sparql, virtuoso_user, virtuoso_pass) add_status = add_lock_result.status_code if add_status > 201: return [False, add_lock_result.content] else: return True