Skip to content

Instantly share code, notes, and snippets.

View gist:0cc9e74b0ef9da5b72f1ef461157cbc1
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))
View gist:04a3c17dcf0dd8e37561e6f1c10a1474
{% extends "base.html" %}
{% block scripts %}
{{super()}}
<script type="text/javascript">
speciesSparql = `
`
View test.graphml
<?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"/>
View wd_wp_federated_query.sparql
#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.
View federated_sparql_template.sparql
SELECT * WHERE {
?localitem ?localproperty ?shareditem .
SERVICE <http://example.remote.sparql> {
?shareditem ?remoteproperty ?remoteitem .
}
}
View shex_1.ttl
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
View concise.ttl
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> {
View concise_shex.shex
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> {
View example2.ttl
PREFIX : <http://hl7.org/fhir/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
<Obs1>
:status "final" ;
:subject <Patient2> .
<Patient2>
:name "Bob" ;
:birthdate "1999-12-31"^^xsd:date .
View test.shex
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/>
You can’t perform that action at this time.