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

Public Member Functions

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

Public Attributes

 name
 
- Public Attributes inherited from searx.engines.wikidata.WDAttribute
 name = name
 

Detailed Description

Definition at line 522 of file wikidata.py.

Member Function Documentation

◆ get_group_by()

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

Reimplemented from searx.engines.wikidata.WDAttribute.

Definition at line 533 of file wikidata.py.

533 def get_group_by(self):
534 return self.get_select()
535

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_select()

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

Reimplemented from searx.engines.wikidata.WDAttribute.

Definition at line 523 of file wikidata.py.

523 def get_select(self):
524 return '?{name} ?{name}Unit'.replace('{name}', self.name)
525

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.WDAmountAttribute.get_str ( self,
result,
language )

Reimplemented from searx.engines.wikidata.WDAttribute.

Definition at line 536 of file wikidata.py.

536 def get_str(self, result, language):
537 value = result.get(self.name)
538 unit = result.get(self.name + "Unit")
539 if unit is not None:
540 unit = unit.replace('http://www.wikidata.org/entity/', '')
541 return value + " " + get_label_for_entity(unit, language)
542 return value
543
544

References searx.engines.wikidata.get_label_for_entity(), searx.engines.wikidata.WDAmountAttribute.name, searx.engines.wikidata.WDAttribute.name, searx.engines.wikidata.WDDateAttribute.name, searx.engines.wikidata.WDGeoAttribute.name, searx.engines.wikidata.WDLabelAttribute.name, searx.preferences.BooleanChoices.name, and searx.search.models.EngineRef.name.

+ Here is the call graph for this function:

◆ get_where()

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

Reimplemented from searx.engines.wikidata.WDAttribute.

Definition at line 526 of file wikidata.py.

526 def get_where(self):
527 return """ OPTIONAL { ?item p:{name} ?{name}Node .
528 ?{name}Node rdf:type wikibase:BestRank ; ps:{name} ?{name} .
529 OPTIONAL { ?{name}Node psv:{name}/wikibase:quantityUnit ?{name}Unit. } }""".replace(
530 '{name}', self.name
531 )
532

References searx.engines.wikidata.WDAmountAttribute.name, searx.engines.wikidata.WDAttribute.name, searx.engines.wikidata.WDDateAttribute.name, searx.engines.wikidata.WDGeoAttribute.name, searx.engines.wikidata.WDLabelAttribute.name, searx.preferences.BooleanChoices.name, and searx.search.models.EngineRef.name.

Member Data Documentation

◆ name


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