BioPAX/OWL and SPARQL
From biopax
Tutorial Slides
Tutorial Material
- start a terminal
- create a directory jena_workspace, move into that directory
- download jena.jar
- download biopax data http://www.biopax.org/Junk/Homosapiens.nt or a smaller file http://www.biopax.org/Junk/Escherichia_coli.nt
BioPAX Level 3 Queries
BASE <http://www.biopax.org/release/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bp: <biopax-level3.owl#>
SELECT ?protein ?pname ?component ?rightcomponent ?rdfT ?pathway
where {
?protein rdf:type bp:Protein.
?protein bp:entityReference ?protRef.
?protRef bp:xref ?xref.
?xref bp:id ?pname.
?component bp:component ?protein .
?rightcomponent bp:right ?component .
?pathway bp:pathwayComponent ?rightcomponent .
?rightcomponent rdf:type ?rdfT.
}
order by ?protein
BASE <http://www.biopax.org/release/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bp: <biopax-level3.owl#>
SELECT distinct ?protein ?pname ?component
where {
?protein rdf:type bp:Protein.
?protein bp:entityReference ?protRef.
?protRef bp:xref ?xref.
?xref bp:id ?pname.
?component bp:component ?protein .
}
order by ?protein
BASE <http://www.biopax.org/release/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bp: <biopax-level3.owl#>
SELECT ?pName ?a ?all ?allvalues
WHERE {
{?pathway bp:pathwayComponent ?comp .
?pathway bp:standardName ?pName .
?comp rdf:type bp:Catalysis .
?comp bp:controlled ?a.
?comp bp:controller ?b.
?a ?all ?allvalues.}
}
BASE <http://www.biopax.org/release/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bp: <biopax-level3.owl#>
SELECT *
WHERE {
{?pathway bp:pathwayComponent ?comp .
?pathway bp:standardName ?pName .
?comp rdf:type bp:BiochemicalReaction .}
UNION
{?pathway bp:pathwayComponent ?comp .
?pathway bp:standardName ?pName .
?comp rdf:type bp:Catalysis .}
}
BASE <http://www.biopax.org/release/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bp: <biopax-level3.owl#>
SELECT ?comp ?x ?pid ?feature ?pidRef ?type ?name
WHERE {
?pathway rdf:type bp:Pathway .
?pathway bp:pathwayComponent ?comp .
?comp rdf:type bp:BiochemicalReaction .
?comp ?x ?pid .
?pid rdf:type bp:Protein .
?pid bp:feature ?feature .
?feature rdf:type ?bp .
?feature bp:modificationType ?type .
?pid bp:entityReference ?pidRef .
?pidRef bp:standardName ?name .
}
BASE <http://www.biopax.org/release/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bp: <biopax-level3.owl#>
SELECT ?comp ?x ?pid ?feature ?pidRef ?type ?name
WHERE {
?pathway rdf:type bp:Pathway .
?pathway bp:pathwayComponent ?comp .
?comp rdf:type bp:BiochemicalReaction .
?comp ?x ?pid .
?pid rdf:type bp:Protein .
?pid bp:feature ?feature .
?feature rdf:type ?bp .
?feature bp:modificationType ?type .
?pid bp:entityReference ?pidRef .
?pidRef bp:standardName ?name .
}
BASE <http://www.biopax.org/release/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bp: <biopax-level3.owl#>
SELECT ?comp ?x ?pid
WHERE {
?pathway rdf:type bp:Pathway .
?pathway bp:pathwayComponent ?comp .
?comp rdf:type bp:BiochemicalReaction .
?comp ?x ?pid .
?pid rdf:type bp:Protein .
}
BASE <http://www.biopax.org/release/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bp: <biopax-level3.owl#>
SELECT ?comp ?name
WHERE {
?pathway rdf:type bp:Pathway .
?pathway bp:pathwayComponent ?comp .
?comp bp:standardName ?name
FILTER (!REGEX(?name, "survival"))
}
BASE <http://www.biopax.org/release/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bp: <biopax-level3.owl#>
SELECT ?xref ?id ?protein
where {
?protein rdf:type bp:Protein.
?protein bp:entityReference ?protRef.
?protRef bp:xref ?xref.
?xref bp:id ?id.
?component bp:component ?protein .
?rightcomponent bp:right ?component .
?pathway bp:pathwayComponent ?rightcomponent .
?rightcomponent rdf:type ?rdfT.
FILTER (REGEX(str(?xref), "P17174", "i")).
}
