.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.engines.wikidata.WDArticle Class Reference
+ Inheritance diagram for searx.engines.wikidata.WDArticle:
+ Collaboration diagram for searx.engines.wikidata.WDArticle:

Public Member Functions

 __init__ (self, language, kwargs=None)
 
 get_label (self, language)
 
 get_select (self)
 
 get_where (self)
 
 get_group_by (self)
 
 get_str (self, result, language)
 
- Public Member Functions inherited from searx.engines.wikidata.WDAttribute
 get_wikibase_label (self)
 
 __repr__ (self)
 

Public Attributes

 language = language
 
 kwargs = kwargs or {}
 
- Public Attributes inherited from searx.engines.wikidata.WDAttribute
 name = name
 

Static Private Attributes

str __slots__ = 'language', 'kwargs'
 

Detailed Description

Definition at line 545 of file wikidata.py.

Constructor & Destructor Documentation

◆ __init__()

searx.engines.wikidata.WDArticle.__init__ ( self,
language,
kwargs = None )

Reimplemented from searx.engines.wikidata.WDAttribute.

Definition at line 549 of file wikidata.py.

549 def __init__(self, language, kwargs=None):
550 super().__init__('wikipedia')
551 self.language = language
552 self.kwargs = kwargs or {}
553

References searx.engines.wikidata.WDArticle.__init__().

Referenced by searx.engines.wikidata.WDArticle.__init__().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ get_group_by()

searx.engines.wikidata.WDArticle.get_group_by ( self)

Reimplemented from searx.engines.wikidata.WDAttribute.

Definition at line 569 of file wikidata.py.

569 def get_group_by(self):
570 return self.get_select()
571

References searx.engines.wikidata.WDAmountAttribute.get_select(), searx.engines.wikidata.WDArticle.get_select(), searx.engines.wikidata.WDAttribute.get_select(), searx.engines.wikidata.WDDateAttribute.get_select(), searx.engines.wikidata.WDGeoAttribute.get_select(), and searx.engines.wikidata.WDLabelAttribute.get_select().

+ Here is the call graph for this function:

◆ get_label()

searx.engines.wikidata.WDArticle.get_label ( self,
language )

Reimplemented from searx.engines.wikidata.WDAttribute.

Definition at line 554 of file wikidata.py.

554 def get_label(self, language):
555 # language parameter is ignored
556 return "Wikipedia ({language})".replace('{language}', self.language)
557

References searx.engines.wikidata.WDArticle.language.

◆ get_select()

searx.engines.wikidata.WDArticle.get_select ( self)

Reimplemented from searx.engines.wikidata.WDAttribute.

Definition at line 558 of file wikidata.py.

558 def get_select(self):
559 return "?article{language} ?articleName{language}".replace('{language}', self.language)
560

References searx.engines.wikidata.WDArticle.language.

Referenced by searx.engines.wikidata.WDAmountAttribute.get_group_by(), searx.engines.wikidata.WDArticle.get_group_by(), searx.engines.wikidata.WDDateAttribute.get_group_by(), and searx.engines.wikidata.WDGeoAttribute.get_group_by().

+ Here is the caller graph for this function:

◆ get_str()

searx.engines.wikidata.WDArticle.get_str ( self,
result,
language )

Reimplemented from searx.engines.wikidata.WDAttribute.

Definition at line 572 of file wikidata.py.

572 def get_str(self, result, language):
573 key = 'article{language}'.replace('{language}', self.language)
574 return result.get(key)
575
576

References searx.engines.wikidata.WDArticle.language.

◆ get_where()

searx.engines.wikidata.WDArticle.get_where ( self)

Reimplemented from searx.engines.wikidata.WDAttribute.

Definition at line 561 of file wikidata.py.

561 def get_where(self):
562 return """OPTIONAL { ?article{language} schema:about ?item ;
563 schema:inLanguage "{language}" ;
564 schema:isPartOf <https://{language}.wikipedia.org/> ;
565 schema:name ?articleName{language} . }""".replace(
566 '{language}', self.language
567 )
568

References searx.engines.wikidata.WDArticle.language.

Member Data Documentation

◆ __slots__

str searx.engines.wikidata.WDArticle.__slots__ = 'language', 'kwargs'
staticprivate

Definition at line 547 of file wikidata.py.

◆ kwargs

searx.engines.wikidata.WDArticle.kwargs = kwargs or {}

Definition at line 552 of file wikidata.py.

◆ language


The documentation for this class was generated from the following file: