Skip to content

Instantly share code, notes, and snippets.

def createProperty(login=login, wdprop=None, lulabel="", enlabel="", frlabel="", delabel="", description="", property_datatype=""):
if wdprop== None:
s = []
else:
s = [wdi_core.WDUrl(wdprop, prop_nr="P1")]
localEntityEngine = wdi_core.WDItemEngine.wikibase_item_engine_factory(api,sparql)
item = localEntityEngine(data=s)
if lulabel != "":
item.set_label(lulabel, lang="lb")
item.set_label(enlabel, lang="en")
SELECT ?taxon ?taxonLabel ?de ?en ?fr ?nl WHERE {
bind(if(bound(?english), "+", "-") as ?en )
bind(if(bound(?french), "+", "-") as ?fr )
bind(if(bound(?dutch), "+", "-") as ?nl )
bind(if(bound(?german), "+", "-") as ?de )
{SELECT ?taxon ?taxonLabel ?english ?french ?dutch ?german WHERE {
wd:Q3052500 wdt:P1990 ?taxon .
OPTIONAL {?english schema:about ?taxon .
FILTER (regex(str(?english), "https://en.wikipedia"))}
OPTIONAL {?dutch schema:about ?taxon .
SELECT ?taxon ?taxonLabel ?de ?en ?fr ?nl WHERE {
bind(if(bound(?english), "+", "-") as ?en )
bind(if(bound(?french), "+", "-") as ?fr )
bind(if(bound(?dutch), "+", "-") as ?nl )
bind(if(bound(?german), "+", "-") as ?de )
{SELECT ?taxon ?taxonLabel ?english ?french ?dutch ?german WHERE {
?taxon wdt:P5588 wd:Q458 .
OPTIONAL {?english schema:about ?taxon .
FILTER (regex(str(?english), "https://en.wikipedia"))}
OPTIONAL {?dutch schema:about ?taxon .
from wikidataintegrator import wdi_core, wdi_login, wdi_helpers
pmid = "22329630"
doi = "10.1016/j.anifeedsci.2007.03.013"
login = wdi_login.WDLogin(<username>, <passwd>)
write = True
print(wdi_helpers.PublicationHelper(doi, id_type="doi", source="crossref").get_or_create(login if write else None))
{% extends "base.html" %}
{% block scripts %}
{{super()}}
<script type="text/javascript">
speciesSparql = `
`
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
<!--Created by yEd 3.17-->
<key attr.name="Description" attr.type="string" for="graph" id="d0"/>
<key for="port" id="d1" yfiles.type="portgraphics"/>
<key for="port" id="d2" yfiles.type="portgeometry"/>
<key for="port" id="d3" yfiles.type="portuserdata"/>
<key attr.name="url" attr.type="string" for="node" id="d4"/>
<key attr.name="description" attr.type="string" for="node" id="d5"/>
<key for="node" id="d6" yfiles.type="nodegraphics"/>
#defaultView:Dimensions
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT DISTINCT ?metabolite1Label ?metabolite2Label ?mass1 ?mass2 WITH {
SELECT ?metabolite1 ?metabolite2 WHERE {
?pathwayItem wdt:P2410 "WP706";
wdt:P2888 ?pwIri.
SERVICE <http://sparql.wikipathways.org/> {
?pathway dc:identifier ?pwIri.
SELECT * WHERE {
?localitem ?localproperty ?shareditem .
SERVICE <http://example.remote.sparql> {
?shareditem ?remoteproperty ?remoteitem .
}
}
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
<wikidata-human_gene> {
p:P31 { ps:P31 [wd:Q7187]; }; # must be instance of [P31] gene [wd:Q7187] (only one)
p:P31 { ps:P31 [wd:Q8054]; }{0} ; # NOT instance of protein [wd:Q8054]
p:P279 { ps:P279 [wd:Q7187 wd:Q20747295 ]; }+ ; # subclass of (one or more) gene = wd:Q7187, protein-coding gene = wd:Q20747295
p:P353 { ps:P353 LITERAL ; } ; # HGNC symbol [P353] (only one)
p:P688 { ps:P688 IRI ;}* ; # encodes [P688] (zero or more)
p:P352 { ps:P352 LITERAL;}{0} ; # NOT a uniprot ID
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX prv: <http://www.wikidata.org/prop/reference/value/>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
<wikidata-human_gene> {