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 de la Bibliothèque du Congrès identifiant BAnQ d'autorité identifiant Freebase identifiant Bibliografie dějin Českých zemí (UUID) identifiant web Léonore identifiant CiNii Research identifiant SHARE Catalogue identifiant Académie française d'un membre identifiant Open Library identifiant Yale LUX identifiant RHE d'un docteur identifiant La France savante CTHS identifiant La France savante CTHS identifiant NLA Trove identifiant Catholic Hierarchy d'une personne identifiant Bibliothèque nationale tchèque identifiant Bibliothèque royale des Pays-Bas identifiant BIBSYS d'une personne identifiant Bibliothèque apostolique vaticane identifiant NUKAT identifiant Université de Barcelone (obsolète) identifiant CONOR.SI identifiant Bibliothèque nationale d'Israël identifiant Université pontificale de la Sainte-Croix identifiant Angelicum identifiant Angelicum identifiant RERO identifiant RERO identifiant Persée d'un auteur identifiant de nomination de personnes au prix Nobel identifiant Babelio d'un auteur identifiant Social Networks Archival Context identifiant Prabook identifiant J9U de la Bibliothèque nationale d'Israël identifiant Rijksmuseum Research Library identifiant Bibliothèque nationale de Pologne identifiant The Cardinals of the Holy Roman Church identifiant CoBiS identifiant Deutsche Biographie identifiant ISNI identifiant GND identifiant Bibliothèque nationale de France identifiant IdRef identifiant NACSIS-CAT d'un auteur identifiant VIAF identifiant VcBA identifiant d’autorité de noms Canadiana identifiant Bibliographie de l’histoire de France d’une personne identifiant GCatholic d'une personne identifiant Bibliothèque nationale du Portugal identifiant FAST identifiant Bibliothèque nationale de Grèce Identifiant Bibliothèque nationale de Lituanie identifiant de la Bibliothèque nationale du Chili identifiant Bibliothèque nationale d'Irlande identifiant Bibliothèque nationale d'Irlande identifiant Bibliothèque nationale d'Australie identifiant SBN d'un auteur identifiant CANTIC identifiant Bibliothèque nationale d'Espagne (datos.BNE.es) identifiant Université de Barcelone identifiant CONOR.SR identifiant SEARCH on line catalogue identifiant Université pontificale de Salamanque identifiant catalogue général Diamond identifiant Biblioteca Iglesia Nacional Española en Roma identifiant Institut pontifical d'archéologie chrétienne Identifiant CIRDOC d'un auteur ou d'une autrice identifiant Parsifal identifiant DDB d'une personne identifiant WorldCat Entities identifiant FranceArchives agent identifiant Biblioteche della Custodia di Terra Santa a Gerusalemme identifiant Franciscan Center of Christian Oriental Studies identifiant Biblioteca di Santa Sabina identifiant Franciscan Center of Christian Oriental Studies identifiant EBAF d'autorité identifiant Académie d'Athènes identifiant Université pontificale grégorienne identifiant Teresianum d'une autorité identifiant Index Theologicus Faulhaber edition person ID Obálky knih ID FES digital collections entity ID Pontifical Urbaniana University ID Pontifical Urbaniana University ID identifiant Biblioteca Virtual Miguel de Cervantes d'une personne identifiant Goodreads d'un auteur ou d'une autrice identifiant Unz d'un auteur identifiant Académie française d'un lauréat identifiant Our Campaigns d'un candidat identifiant d’autorité Bibliothèque royale de Belgique

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