wd search "SePublica"
Q30276418 Proceedings of the 2nd Workshop on Semantic Publishing
For result see List of Scholars
#!/bin/bash
# WF 2022-08-08
# search for a scholar
wikidataProps() {
cat << EOF
item given_name P735 firstName
item family_name P734 name
url official_website P856 homepage
id DBLP_author_ID P2456 dblpId
id ORCID P496 orcid
id LinkedIn personal profile ID P634 linkedInId
id GND_ID P227 gndId
id Google_Scholar_author_ID P1960 googleScholarUser
EOF
}
smwScholar() {
local l_qid="$1"
cat << EOF
{{Scholar
|wikiDataId=$l_qid
EOF
wikidataProps | while read line
do
propType=$(echo $line | cut -f1 -d ' ')
propName=$(echo $line | cut -f2 -d ' ')
propId=$(echo $line | cut -f3 -d ' ')
propVar=$(echo $line | cut -f4 -d ' ')
#echo $propId
propValue=$(wd q --subject $l_qid -p $propId 2>&1)
if [ $? -eq 0 ]
then
case $propType in
'item')
propValue=$(wd label $propValue)
;;
esac
echo "|$propVar=$propValue"
fi
done
cat << EOF
}}
EOF
}
name="$*"
wd search "$name" | while read line
do
echo $line
qid=$(echo $line | cut -f1 -d' ')
smwScholar "$qid"
done