Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/)

## [1.4.2] 2025-05-05

### Changed

- evaluate command
- changed approach to not break results but to consider empty output from SPARQL when response is not available in the response file

## [1.4.1] 2025-05-02

### Added
Expand Down
11 changes: 7 additions & 4 deletions text2sparql_client/commands/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,18 @@ def evaluate_command( # noqa: PLR0913
for lang in languages:
result_true = get_json(question["query"]["sparql"], endpoint)
yml_qname = f"{dataset_prefix}:{question['id']}-{lang}"

try:
response_idx = next(
i for i, response in enumerate(json_file) if response["qname"] == yml_qname
)
except IndexError:
result_predicted = get_json(json_file[response_idx]["query"], endpoint)
except StopIteration:
logger.info(f"\n-------\nqname {yml_qname} not found in responses\n-------\n")
raise

result_predicted = get_json(json_file[response_idx]["query"], endpoint)
result_predicted = {
"head": {"link": [], "vars": []},
"results": {"distinct": False, "ordered": True, "bindings": []},
}

db2pytrec = DBpediaDict2PytrecDict(f"{dataset_prefix}:{question['id']}-{lang}")
result_predicted = db2pytrec.tranform(result_predicted)
Expand Down