Skip to content

Commit

Permalink
raise exception to check the issue on server
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya-Oladazimi committed Oct 19, 2023
1 parent 6ccd256 commit 8cf8293
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Compatibility with core CKAN versions:

- **crc1153_system_stats**: The system stats (data resources count, formats, etc) for system admins.

- **crc1153_dcat_ap**: The CRC1153 DCAT profile extension based the CRC-specific vocabulary.
- **crc1153_dcat_profile**: The CRC1153 DCAT profile extension based the CRC-specific vocabulary.

- **crc1153_search**: Extending The CKAN search to enable users to search for dataset and data resources based on the CRC-specific metadata.

Expand Down
6 changes: 3 additions & 3 deletions ckanext/crc1153/libs/crc_profile/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def get_linked_samples(resource_id):
def insert_to_sparql(graph):
for s,p,o in graph:
s,p,o = Crc1153DcatProfileHelper.clean_triples(s,p,o)
query = 'INSERT DATA{ ' + s + ' ' + p + ' ' + o + ' . }'
sparql = SPARQLWrapper(Crc1153DcatProfileHelper.get_apache_jena_endpoint())
query = 'INSERT DATA{ ' + s + ' ' + p + ' ' + o + ' . }'
sparql = SPARQLWrapper(Crc1153DcatProfileHelper.get_apache_jena_endpoint())
sparql.setMethod(POST)
sparql.setQuery(query)
results = sparql.query()
Expand All @@ -82,7 +82,7 @@ def insert_to_sparql(graph):
def delete_from_sparql(graph):
for s,p,o in graph:
s,p,o = Crc1153DcatProfileHelper.clean_triples(s,p,o)
query = ""
query = ""
if "_:N" in o:
# blank node as object
query = 'DELETE{ ' + s + ' ' + p + ' ?bnode . ?bnode ?p ?o .} WHERE{ ' + s + ' ' + p + ' ?bnode . ?bnode ?p ?o . FILTER (isBlank(?bnode))}'
Expand Down
9 changes: 4 additions & 5 deletions ckanext/crc1153/plugins/crc_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,14 @@ def after_update(self, context, pkg_dict):
Upadte an existing dataset metadata on the sparql endpoint
'''

try:
package = toolkit.get_action('package_show')({}, {'name_or_id': pkg_dict['id']})
print(package)
try:
package = toolkit.get_action('package_show')({}, {'name_or_id': pkg_dict['id']})
graph = Helper.get_dataset_graph(package)
res_d = Helper.delete_from_sparql(graph)
res_i = Helper.insert_to_sparql(graph)
except:
return pkg_dict
# raise
# return pkg_dict
raise

return pkg_dict

Expand Down

0 comments on commit 8cf8293

Please sign in to comment.