Skip to content

Commit

Permalink
Use URLs instead of IDs for constants
Browse files Browse the repository at this point in the history
This makes it easier to go from this file to the actual data for the
item or property, either to check that the attribute name in the file is
correct, or to look something up about the entity.
  • Loading branch information
dseomn committed Oct 25, 2023
1 parent 3446371 commit 710a6fe
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions rock_paper_sand/wikidata_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ def uri(self) -> str:
return f"{_ITEM_PREFIX_CANONICAL_URI}{self.id}"


Q_GREGORIAN_CALENDAR = Item("Q12138")
Q_PROLEPTIC_GREGORIAN_CALENDAR = Item("Q1985727")
_i = Item.from_string
Q_GREGORIAN_CALENDAR = _i("https://www.wikidata.org/wiki/Q12138")
Q_PROLEPTIC_GREGORIAN_CALENDAR = _i("https://www.wikidata.org/wiki/Q1985727")
del _i

_PROPERTY_PREFIX_FOR_HUMAN = "https://www.wikidata.org/wiki/Property:"

Expand Down Expand Up @@ -117,7 +119,9 @@ def from_string(cls, value: str) -> Self:
)


P_DATE_OF_FIRST_PERFORMANCE = Property("P1191")
P_END_TIME = Property("P582")
P_PUBLICATION_DATE = Property("P577")
P_START_TIME = Property("P580")
_p = Property.from_string
P_DATE_OF_FIRST_PERFORMANCE = _p("https://www.wikidata.org/wiki/Property:P1191")
P_END_TIME = _p("https://www.wikidata.org/wiki/Property:P582")
P_PUBLICATION_DATE = _p("https://www.wikidata.org/wiki/Property:P577")
P_START_TIME = _p("https://www.wikidata.org/wiki/Property:P580")
del _p

0 comments on commit 710a6fe

Please sign in to comment.