Différences entre versions de « Module:Notice Autorité »

De Gregorius 3.0
Sauter à la navigation Sauter à la recherche
(Page créée avec « --[[ -- Debug console frame = mw.getCurrentFrame() -- Get a frame object newFrame = frame:newChild{ -- Get one with args title = 'Alfred Baudrillart' , args = { iri =… »)
 
Ligne 29 : Ligne 29 :
  
  
select ?prop ?propLabel ?ID ?formater ?logo
+
select DISTINCT ?prop ?propLabel ?ID ?formater # ?logo
 
where {
 
where {
 
    
 
    
Ligne 36 : Ligne 36 :
 
  ?prop  wikibase:directClaim ?propClaim .
 
  ?prop  wikibase:directClaim ?propClaim .
 
  ?prop wdt:P1630 ?formater .
 
  ?prop wdt:P1630 ?formater .
   ?prop wdt:P2378 ?entity .
+
#   ?prop wdt:P2378 ?entity .
   ?entity wdt:P154 ?logo .  
+
#   ?entity wdt:P154 ?logo .  
 
    
 
    
 
   wd:Q666551 ?propClaim ?ID .
 
   wd:Q666551 ?propClaim ?ID .
Ligne 43 : Ligne 43 :
 
    
 
    
 
   SERVICE wikibase:label {
 
   SERVICE wikibase:label {
       bd:serviceParam wikibase:language "en,fr" .
+
       bd:serviceParam wikibase:language "fr,en" .
 
   }
 
   }
  
Ligne 51 : Ligne 51 :
 
-- linkedwiki.print_r(result)
 
-- linkedwiki.print_r(result)
 
 
    local text = ""
+
    local text = "<span class='plainlinks module-oeuvres-vignettes'>"
 
local i = 0
 
local i = 0
 
local row = nill
 
local row = nill
 +
local link = nil
 +
local logo = nil
 
row = result['result']['rows'][i]
 
row = result['result']['rows'][i]
 
while( row ~= nil )
 
while( row ~= nil )
 
do
 
do
 
--linkedwiki.print_r(row)
 
--linkedwiki.print_r(row)
 +
  link = string.gsub(row["formater"], "$1",row["ID"])
 
   
 
   
  text = text .. row["logo"] .. " ".. row["propLabel"] .. " ".. row["formater"] .. row["ID"]
+
-- if string.sub( row["logo"], -3 ) == 'svg' then
 +
-- logo = "[[".. string.gsub(row["logo"], "http://commons.wikimedia.org/wiki/Special:FilePath/","File:").."|70px|link=".. link .. "]]"
 +
-- else
 +
-- logo = "[" .. link .. " " .. logo .. "]"
 +
-- end
 +
 
 +
  text = text .. " [".. link .. " ".. row["propLabel"] .. "] "
 
   
 
   
 
  i = i + 1
 
  i = i + 1
 
  row = result['result']['rows'][i]
 
  row = result['result']['rows'][i]
 
end
 
end
 +
 +
    local text = text .. "</span>"
  
 
   return text
 
   return text

Version du 21 novembre 2021 à 14:52

Utilisation

Ce module a pour fonction de pouvoir afficher les notices d'un auteur via Wikidata

Exemple d'utilisation

{{#invoke:Oeuvres de l'auteur|section
| Wikidata ID = Q666551
}}

Résultat pour Alfred Baudrillart

identifiant BAnQ d'autorité identifiant Bibliothèque du Congrès identifiant Freebase identifiant Bibliografie dějin Českých zemí (UUID) identifiant Bibliothèque nationale de Grèce PUG authority ID identifiant Open Library identifiant SHARE Catalogue identifiant Parsifal identifiant Angelicum identifiant Université pontificale de la Sainte-Croix identifiant WorldCat Entities identifiant VIAF identifiant Angelicum identifiant Catholic Hierarchy d'une personne identifiant CiNii Research identifiant Bibliothèque nationale de Pologne identifiant Rijksmuseum Research Library identifiant J9U de la Bibliothèque nationale d'Israël identifiant The Cardinals of the Holy Roman Church identifiant VcBA identifiant CoBiS identifiant d’autorité de noms Canadiana identifiant World Biographical Information System identifiant Académie française d'un membre identifiant Bibliographie de l’histoire de France d’une personne identifiant CONOR.SR identifiant catalogue général Diamond identifiant Institut pontifical d'archéologie chrétienne identifiant Université de Barcelone identifiant RHE d'un docteur identifiant Université pontificale de Salamanque identifiant Biblioteca Iglesia Nacional Española en Roma identifiant FranceArchives agent identifiant Biblioteca di Santa Sabina identifiant SEARCH on line catalogue identifiant Biblioteche della Custodia di Terra Santa a Gerusalemme identifiant IdRef identifiant Bibliothèque nationale de France Identifiant CIRDOC d'un auteur ou d'une autrice identifiant GND (DNB) identifiant DDB d'une personne identifiant NLA Trove identifiant CONOR.SI ancien identifiant Bibliothèque nationale de Catalogne identifiant d’autorité Bibliothèque royale de Belgique identifiant EBAF d'autorité identifiant Franciscan Center of Christian Oriental Studies identifiant Franciscan Center of Christian Oriental Studies identifiant CANTIC identifiant Social Networks Archival Context identifiant ISNI identifiant Bibliothèque nationale tchèque identifiant Bibliothèque nationale d'Israël identifiant Bibliothèque nationale d'Australie identifiant NUKAT identifiant NACSIS-CAT d'un auteur identifiant Bibliothèque royale des Pays-Bas identifiant Bibliothèque nationale d'Espagne identifiant SBN d'un auteur identifiant Bibliothèque nationale du Portugal identifiant BIBSYS d'une personne identifiant Bibliothèque apostolique vaticane identifiant Bibliothèque nationale d'Irlande identifiant Bibliothèque nationale d'Irlande identifiant Académie d'Athènes identifiant Index Theologicus identifiant RERO identifiant RERO identifiant FAST identifiant Université de Barcelone (obsolète) identifiant La France savante CTHS identifiant Persée d'un auteur identifiant Teresianum d'une autorité identifiant web Léonore identifiant Biblioteca Virtual Miguel de Cervantes d'une personne identifiant Unz d'un auteur identifiant Babelio d'un auteur identifiant Prabook identifiant de nomination de personnes au prix Nobel identifiant Académie française d'un lauréat identifiant de la Bibliothèque nationale du Chili identifiant Lietuvos nacionalinė Martyno Mažvydo biblioteka

Paramétres

  • Wikidata ID : Id de Wikidata

--[[
-- Debug console

frame = mw.getCurrentFrame() -- Get a frame object
newFrame = frame:newChild{ -- Get one with args
	title = 'Alfred Baudrillart' ,
 args = { 
 iri = 'https://gregorius.dsi.universite-paris-saclay.fr/wiki/Alfred_Baudrillart' ,
["Wikidata ID"] = 'Q666551' 
    }
}
mw.log(p.section( newFrame ) )
]]


local p = {}

 local linkedwiki = require 'linkedwiki'
function p.section(f)
	local object =  linkedwiki.new()
    object:setConfig("http://www.wikidata.org")
    mw.log(object:getConfig())

	local result = object:query( [[
PREFIX bd: <http://www.bigdata.com/rdf#> 
PREFIX wikibase: <http://wikiba.se/ontology#> 
PREFIX wd: <http://www.wikidata.org/entity/> 
PREFIX wdt: <http://www.wikidata.org/prop/direct/> 


select DISTINCT ?prop ?propLabel ?ID ?formater # ?logo
where {
  
  ?prop wdt:P31/wdt:P279* wd:Q18614948 .
  
 ?prop  wikibase:directClaim ?propClaim .
 ?prop wdt:P1630 ?formater .
#   ?prop wdt:P2378 ?entity .
#    ?entity wdt:P154 ?logo . 
  
  wd:Q666551 ?propClaim ?ID .
  
  
  SERVICE wikibase:label {
       bd:serviceParam wikibase:language "fr,en" .
  }

} 
LIMIT 100
		]] 	)
-- linkedwiki.print_r(result)
	
	    local text = "<span class='plainlinks module-oeuvres-vignettes'>"
	local i = 0
	local row = nill
	local link = nil
	local logo = nil
	row = result['result']['rows'][i]
	while( row ~= nil )
	do
	 --linkedwiki.print_r(row)
	  link = string.gsub(row["formater"], "$1",row["ID"])
	  
	 -- if string.sub( row["logo"], -3 ) == 'svg' then
	 -- 	 logo = "[[".. string.gsub(row["logo"], "http://commons.wikimedia.org/wiki/Special:FilePath/","File:").."|70px|link=".. link .. "]]"
		-- else
		-- 	logo = "[" .. link .. " " .. logo .. "]"
	 -- end
	  
	  text = text .. " [".. link .. " ".. row["propLabel"] .. "] "  
	  
	  i = i + 1
	  row = result['result']['rows'][i]
	end
	
	    local text = text .. "</span>"

  return text
end
 
return p