-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add query to delete statement #93
Conversation
…L-according-to-PKG-data-model-utilspy' into feature/64-sparql-delete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some clarification is needed in several places and two tests are missing.
pkg_api/utils.py
Outdated
Returns: | ||
SPARQL query. | ||
""" | ||
blank_node_id = "?statement" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it always the same? Can we make it a global variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a global variable _SPARQL_STATEMENT_VARIABLE
for ?statement
, please check that it does not impact the readability of the queries.
""" | ||
blank_node_id = "?statement" | ||
statement = _get_statement_representation(pkg_data, blank_node_id) | ||
# Remove statement description from conditions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description is removed because it not possible that it is the same when asking to remove a statement, especially when using natural language. For example, a user might input "Delete my preference towards Tom Cruise" or " Remove the statements related to Tom Cruise" to remove the statement "I like Tom Cruise."
|
||
assert utils.get_query_for_remove_statement( | ||
pkg_data_example | ||
) == strip_string(sparql_query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests for get_queries_for_remove_cleanup
and for get_query_for_remove_preference
are missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test for get_query_for_remove_preference
. I am not sure a test is needed for get_queries_for_remove_cleanup
because it appears to be already covered and it returns a string without alteration by a variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add SPARQL DELETE query. The query also includes the removal of derived preferences.
Part of #64