Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Mar 28, 2024
1 parent 054f01a commit 1dac09b
Show file tree
Hide file tree
Showing 15 changed files with 463 additions and 336 deletions.
2 changes: 1 addition & 1 deletion ez_wikidata/__init__.py
@@ -1 +1 @@
__version__ = "0.2.2"
__version__ = "0.2.3"
7 changes: 5 additions & 2 deletions ez_wikidata/prefixes.py
@@ -1,12 +1,15 @@
'''
"""
Created on 2024-03-02
@author: wf
'''
"""


class Prefixes:
"""
handle standard Prefixes
"""

@classmethod
def getPrefixes(
cls, prefixes=["rdf", "rdfs", "schema", "wd", "wdt", "wikibase", "xsd"]
Expand Down
14 changes: 8 additions & 6 deletions ez_wikidata/trulytabular.py
Expand Up @@ -12,9 +12,11 @@
from lodstorage.query import Endpoint, Query, QueryManager, YamlPath
from lodstorage.sparql import SPARQL
from lodstorage.version import Version

from ez_wikidata.prefixes import Prefixes
from ez_wikidata.wdproperty import WikidataProperty, WikidataPropertyManager
from ez_wikidata.wikidata import WikidataItem
from ez_wikidata.prefixes import Prefixes


class TrulyTabular(object):
"""
Expand Down Expand Up @@ -50,7 +52,9 @@ def __init__(
if endpointConf is None:
endpointConf = Endpoint.getDefault()
self.endpointConf = endpointConf
self.wpm=WikidataPropertyManager.get_instance(endpoint_url=endpointConf.endpoint)
self.wpm = WikidataPropertyManager.get_instance(
endpoint_url=endpointConf.endpoint
)
self.sparql = SPARQL(endpointConf.endpoint, method=self.endpointConf.method)
self.sparql.debug = self.debug
self.search_predicate = search_predicate
Expand All @@ -60,11 +64,9 @@ def __init__(
itemQid, sparql=self.sparql, lang=lang, debug=self.debug
)
self.queryManager = TrulyTabular.getQueryManager(debug=self.debug)
self.properties = self.wpm.get_properties_by_ids(
propertyIds
)
self.properties = self.wpm.get_properties_by_ids(propertyIds)
self.properties.update(
self.wpm.get_properties_by_labels(propertyLabels,lang=lang)
self.wpm.get_properties_by_labels(propertyLabels, lang=lang)
)
self.isodate = datetime.datetime.now().isoformat()
self.error = None
Expand Down
2 changes: 1 addition & 1 deletion ez_wikidata/version.py
Expand Up @@ -17,7 +17,7 @@ class Version(object):
name = "py_ez_wikidata"
version = ez_wikidata.__version__
date = "2024-03-01"
updated = "2024-03-20"
updated = "2024-03-28"
description = "Mapping for Wikidata allows creation of wikidata entries from dicts"

authors = "Tim Holzheim, Wolfgang Fahl"
Expand Down
12 changes: 8 additions & 4 deletions ez_wikidata/wbquery.py
Expand Up @@ -5,15 +5,19 @@
"""
import pprint
from typing import Dict, List
from ez_wikidata.wikidata import PropertyMapping, WdDatatype

from ez_wikidata.wdproperty import WikidataPropertyManager
from ez_wikidata.wikidata import PropertyMapping, WdDatatype


class WikibaseQuery(object):
"""
a Query for Wikibase
"""

def __init__(self, entity: str,wpm:WikidataPropertyManager=None,debug: bool = False):
def __init__(
self, entity: str, wpm: WikidataPropertyManager = None, debug: bool = False
):
"""
Constructor
Expand All @@ -24,8 +28,8 @@ def __init__(self, entity: str,wpm:WikidataPropertyManager=None,debug: bool = Fa
self.debug = debug
self.entity = entity
if wpm is None:
wpm=WikidataPropertyManager.get_instance()
self.wpm=wpm
wpm = WikidataPropertyManager.get_instance()
self.wpm = wpm
self.propertiesByName = {}
self.propertiesById = {}
self.propertiesByVarname = {}
Expand Down

0 comments on commit 1dac09b

Please sign in to comment.