Commit 8243971d36c7aca8332abe58f5b233413272da35
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'virtuoso_integration' of gitlab.com:participa/noosfero into virtuoso_integration
Showing
1 changed file
with
9 additions
and
3 deletions
Show diff stats
plugins/virtuoso/lib/virtuoso_plugin/triples_management.rb
| ... | ... | @@ -18,15 +18,21 @@ class VirtuosoPlugin::TriplesManagement |
| 18 | 18 | def update_triple(graph_uri, from_triple, to_triple) |
| 19 | 19 | from_subject = from_triple[:subject] |
| 20 | 20 | from_predicate = from_triple[:predicate] |
| 21 | - from_object = from_triple[:object] | |
| 21 | + from_object = format_triple_term(from_triple[:object]) | |
| 22 | 22 | |
| 23 | 23 | to_subject = to_triple[:subject] |
| 24 | 24 | to_predicate = to_triple[:predicate] |
| 25 | - to_object = to_triple[:object] | |
| 25 | + to_object = format_triple_term(to_triple[:object]) | |
| 26 | 26 | |
| 27 | - query = "WITH <#{graph_uri}> DELETE { <#{from_subject}> <#{from_predicate}> '#{from_object}' } INSERT { <#{to_subject}> <#{to_predicate}> '#{to_object}' }" | |
| 27 | + query = "WITH <#{graph_uri}> DELETE { <#{from_subject}> <#{from_predicate}> #{from_object} } INSERT { <#{to_subject}> <#{to_predicate}> #{to_object} }" | |
| 28 | 28 | |
| 29 | 29 | plugin.virtuoso_client.query(query) |
| 30 | 30 | end |
| 31 | 31 | |
| 32 | + protected | |
| 33 | + | |
| 34 | + def format_triple_term(term) | |
| 35 | + term =~ /^(http|https):\/\// ? "<#{term}>" : "'#{term}'" | |
| 36 | + end | |
| 37 | + | |
| 32 | 38 | end | ... | ... |