Skip to content

Instantly share code, notes, and snippets.

@ktym
Last active March 10, 2020 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ktym/34316e1646875af5b3f938390b4297b4 to your computer and use it in GitHub Desktop.
Save ktym/34316e1646875af5b3f938390b4297b4 to your computer and use it in GitHub Desktop.
"""
Example RDF/Turtle:
hnt:A0A024QYV7-Q00653
bp3:dataSource <http://identifiers.org/HINT> ;
bp3:displayName "A0A024QYV7-Q00653"^^xsd:string ;
bp3:evidence pint:evidence-pubmed_14743216-MI_0007-literature-curated , pint:evidence-pubmed_14743216-MI_0676-literature-curated ;
bp3:name "A0A024QYV7-Q00653"^^xsd:string ;
bp3:participant [
obo:BFO_0000051 uni:A0A024QYV7 ;
] ;
bp3:participant [
obo:BFO_0000051 uni:Q00653 ;
] ;
pint:networkVariety "binary"^^xsd:string ;
pint:accuracy "low"^^xsd:string ;
a bp3:MolecularInteraction .
Example index.graphql:
type Query {
hint(iri: [String!], id: String): [HiNT!]!
}
Example GraphQL:
query {
hint(iri: "http://purl.jp/10/hint/A0A024QYV7-Q00653") {
iri
name
participant
evidence
accuracy
}
}
query {
hint(id: "A0A024QYV7") {
iri
name
participant
evidence
accuracy
}
}
--- endpoint ---
http://sparql.med2rdf.org/sparql
--- sparql ---
PREFIX : <https://github.com/dbcls/grasp/>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX pint: <http://purl.jp/10/pint/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX hnt: <http://purl.jp/10/hint/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX pfm: <http://identifiers.org/Pfam/>
PREFIX bp3: <http://www.biopax.org/release/biopax-level3.owl#>
PREFIX uni: <http://identifiers.org/uniprot/>
CONSTRUCT {
?iri :iri ?iri .
?iri :display_name ?display_name .
?iri :evidence ?evidence .
?iri :name ?name .
?iri :participant ?pair0 .
?iri :participant ?pair1 .
?iri :network_variety ?network_variety .
?iri :accuracy ?accuracy .
}
WHERE
{
?iri
bp3:dataSource ?data_source ;
bp3:displayName ?display_hame ;
bp3:evidence ?evidence ;
bp3:name ?name ;
bp3:participant [
obo:BFO_0000051 ?pair0 ;
] ;
bp3:participant [
obo:BFO_0000051 ?pair1 ;
] ;
pint:networkVariety ?network_variety ;
pint:accuracy ?accuracy ;
a bp3:MolecularInteraction .
{{filter-by-iri}}
FILTER (?pair0 = uni:{{id}} || ?pair1 = uni:{{id}})
# {{#filter-by pair0 as |id|}}
# uni:{{id}}
# {{/filter-by}}
#
# {{#filter-by pair1 as |id|}}
# uni:{{id}}
# {{/filter-by}}
}
"""
type HiNT {
iri: String!
display_name: String
evidence: [String]
name: String
participant: [String]
network_variety: String
accuracy: String
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment