Skip to content

Commit

Permalink
fixes get_property_by_id
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Mar 6, 2024
1 parent 272788a commit 30aedb4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ez_wikidata/wdproperty.py
Expand Up @@ -321,7 +321,7 @@ def get_property_by_id(self, property_id: str) -> WikidataProperty:
Args:
property_id(str): a property ID e.g. "P6375"
"""
properties = self.get_properties_by_ids(property_id)
properties = self.get_properties_by_ids([property_id])
prop_count = len(properties)
if prop_count == 1:
return list(properties.values())[0]
Expand Down
7 changes: 4 additions & 3 deletions tests/testTrulyTabular.py
Expand Up @@ -12,8 +12,7 @@
from lodstorage.sparql import SPARQL
from ez_wikidata.trulytabular import TrulyTabular
from ez_wikidata.wikidata import WikidataItem
from ez_wikidata.wdproperty import WikidataProperty, WikidataPropertyManager

from ez_wikidata.wdproperty import WikidataPropertyManager

class TestTrulyTabular(unittest.TestCase):
"""
Expand Down Expand Up @@ -152,7 +151,7 @@ def testGetItemsByLabel(self):
try getting items by label
"""
debug = self.debug
debug = True
#debug = True
qLabels = [
"academic conference",
"scientific conference series",
Expand Down Expand Up @@ -370,8 +369,10 @@ def testGenWdPropertyStatistic(self):
wpm=WikidataPropertyManager.get_instance(endpoint_url=endpointConf.endpoint)
try:
tt = TrulyTabular(qid, debug=debug)
# P571: inception, P6375: street address
for pid in ["P571", "P6375"]:
wdProperty = wpm.get_property_by_id(pid)
self.assertIsNotNone(wdProperty)
#
itemCount, _itemCountQuery = tt.count()
statsRow = tt.genWdPropertyStatistic(wdProperty, itemCount)
Expand Down

0 comments on commit 30aedb4

Please sign in to comment.