PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?compound ?label ?napid ?keggid ?casid
WHERE {
?compound wdt:P31 wd:Q11173 ;
rdfs:label ?label
FILTER ( lang(?label) = "en" )
OPTIONAL {?compound wdt:P2064 ?napid .}
OPTIONAL {?compound wdt:P665 ?keggid . }
OPTIONAL {?compound wdt:P231 ?casid . }
}
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?compound ?label ?knapsackid ?keggid ?casid
WHERE { ?compound wdt:P2064 ?id ;
rdfs:label ?label
FILTER ( lang(?label) = "en" )
OPTIONAL {?compound wdt:P2064 ?knapsackid .}
OPTIONAL {?compound wdt:P665 ?keggid . }
OPTIONAL {?compound wdt:P231 ?casid . }
}
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?compound ?id WHERE {
?compound wdt:P2064 ?id .
}
import pywikibot
site = pywikibot.Site("wikidata", "wikidata")
repo = site.data_repository()
item = pywikibot.ItemPage(repo, u"Q415011")
print item.contributors()
stringclaim = pywikibot.Claim(repo, u'P2064')
stringclaim.setTarget(u"C00000674")
item.addClaim(stringclaim)