Skip to content

Commit

Permalink
Fix forms check to allow for preposition forms + Danish fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtavis committed Jan 5, 2025
1 parent 5e8ac5c commit e523d81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/scribe_data/check/check_query_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ def validate_forms(query_text: str) -> str:
select_vars = select_vars[2:]
# Regex pattern to capture the variables in the WHERE clause.
dt_pattern = r"WHERE\s*\{[^}]*?wikibase:lemma\s*\?\s*(\w+)\s*[;.]\s*"
potential_prep_case_pattern = r"caseForm rdfs:label.*[.]"
forms_pattern = r"ontolex:representation \?([^ ;]+)"
where_vars = []

Expand All @@ -323,6 +324,10 @@ def validate_forms(query_text: str) -> str:
elif dt_match:
where_vars.append(dt_match[0])

potential_prep_case_match = re.findall(potential_prep_case_pattern, query_text)
if potential_prep_case_match and "grammaticalCase" in potential_prep_case_match[0]:
where_vars.append("grammaticalCase")

where_vars += re.findall(forms_pattern, query_text)

# Handling labels provided by the labeling service like 'case' and 'gender' in the same order as in select_vars.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
SELECT
(REPLACE(STR(?lexeme), "http://www.wikidata.org/entity/", "") AS ?lexemeID)
?preposition
?grammaticalCase

WHERE {
?lexeme dct:language wd:Q9035 ;
Expand Down

0 comments on commit e523d81

Please sign in to comment.