Skip to content

Commit

Permalink
Update sparql-gp.js, less DDoS
Browse files Browse the repository at this point in the history
For geneontology/api-gorest#3
Trying to bring on @balhoff 's changes to the experimental codebase (geneontology/api-gorest#3 (comment))
  • Loading branch information
kltm committed Dec 17, 2021
1 parent a9c41a5 commit 1224fee
Showing 1 changed file with 30 additions and 45 deletions.
75 changes: 30 additions & 45 deletions queries/sparql-gp.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,80 +70,65 @@ module.exports = {
PREFIX pr: <http://purl.org/ontology/prv/core#>
PREFIX metago: <http://model.geneontology.org/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX obo: <http://www.geneontology.org/formats/oboInOwl#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX providedBy: <http://purl.org/pav/providedBy>
PREFIX MF: <http://purl.obolibrary.org/obo/GO_0003674>
PREFIX causally_upstream_of_or_within: <http://purl.obolibrary.org/obo/RO_0002418>
PREFIX causally_upstream_of_or_within_negative_effect: <http://purl.obolibrary.org/obo/RO_0004046>
PREFIX causally_upstream_of_or_within_positive_effect: <http://purl.obolibrary.org/obo/RO_0004047>
PREFIX causally_upstream_of: <http://purl.obolibrary.org/obo/RO_0002411>
PREFIX causally_upstream_of_negative_effect: <http://purl.obolibrary.org/obo/RO_0002305>
PREFIX causally_upstream_of_positive_effect: <http://purl.obolibrary.org/obo/RO_0002304>
PREFIX regulates: <http://purl.obolibrary.org/obo/RO_0002211>
PREFIX negatively_regulates: <http://purl.obolibrary.org/obo/RO_0002212>
PREFIX positively_regulates: <http://purl.obolibrary.org/obo/RO_0002213>
PREFIX directly_regulates: <http://purl.obolibrary.org/obo/RO_0002578>
PREFIX directly_positively_regulates: <http://purl.obolibrary.org/obo/RO_0002629>
PREFIX directly_negatively_regulates: <http://purl.obolibrary.org/obo/RO_0002630>
PREFIX directly_activates: <http://purl.obolibrary.org/obo/RO_0002406>
PREFIX indirectly_activates: <http://purl.obolibrary.org/obo/RO_0002407>
PREFIX directly_inhibits: <http://purl.obolibrary.org/obo/RO_0002408>
PREFIX indirectly_inhibits: <http://purl.obolibrary.org/obo/RO_0002409>
PREFIX transitively_provides_input_for: <http://purl.obolibrary.org/obo/RO_0002414>
PREFIX immediately_causally_upstream_of: <http://purl.obolibrary.org/obo/RO_0002412>
PREFIX directly_provides_input_for: <http://purl.obolibrary.org/obo/RO_0002413>
PREFIX enabled_by: <http://purl.obolibrary.org/obo/RO_0002333>
SELECT distinct ?gocam ?title
WHERE
{
VALUES ?causal { causally_upstream_of_or_within: causally_upstream_of_or_within_negative_effect: causally_upstream_of_or_within_positive_effect:
causally_upstream_of: causally_upstream_of_negative_effect: causally_upstream_of_positive_effect: regulates:
negatively_regulates: positively_regulates: directly_regulates: directly_positively_regulates: directly_negatively_regulates:
directly_activates: indirectly_activates: directly_inhibits: indirectly_inhibits: transitively_provides_input_for:
immediately_causally_upstream_of: directly_provides_input_for: }
VALUES ?causal2 { causally_upstream_of_or_within: causally_upstream_of_or_within_negative_effect: causally_upstream_of_or_within_positive_effect:
causally_upstream_of: causally_upstream_of_negative_effect: causally_upstream_of_positive_effect: regulates:
negatively_regulates: positively_regulates: directly_regulates: directly_positively_regulates: directly_negatively_regulates:
directly_activates: indirectly_activates: directly_inhibits: indirectly_inhibits: transitively_provides_input_for:
immediately_causally_upstream_of: directly_provides_input_for: }
PREFIX hint: <http://www.bigdata.com/queryHints#>
SELECT DISTINCT ?gocam ?title
WHERE {
GRAPH ?gocam {
# Inject gene product ID here
?gene rdf:type <http://identifiers.org/rgd/1586460> .
}
?gocam metago:graphType metago:noctuaCam .
?gocam dc:title ?title .
GRAPH ?gocam {
?gocam metago:graphType metago:noctuaCam .
?s enabled_by: ?gpnode .
?gpnode rdf:type ?identifier .
?gocam dc:title ?title .
?ind1 ?causal ?ind2 .
?ind2 ?causal2 ?ind3 .
VALUES ?causal { causally_upstream_of_or_within: causally_upstream_of_or_within_negative_effect: causally_upstream_of_or_within_positive_effect: causally_upstream_of: causally_upstream_of_negative_effect: causally_upstream_of_positive_effect: regulates: negatively_regulates: positively_regulates: directly_regulates: directly_positively_regulates: directly_negatively_regulates: directly_activates: indirectly_activates: directly_inhibits: indirectly_inhibits: transitively_provides_input_for: immediately_causally_upstream_of: directly_provides_input_for: }
VALUES ?causal2 { causally_upstream_of_or_within: causally_upstream_of_or_within_negative_effect: causally_upstream_of_or_within_positive_effect: causally_upstream_of: causally_upstream_of_negative_effect: causally_upstream_of_positive_effect: regulates: negatively_regulates: positively_regulates: directly_regulates: directly_positively_regulates: directly_negatively_regulates: directly_activates: indirectly_activates: directly_inhibits: indirectly_inhibits: transitively_provides_input_for: immediately_causally_upstream_of: directly_provides_input_for: }
#?s enabled_by: ?gpnode . # I don't think this is needed for this query
#?gpnode rdf:type ?identifier . # I don't think this is needed for this query
?ind1 enabled_by: ?gpnode1 .
?ind2 enabled_by: ?gpnode2 .
?ind3 enabled_by: ?gpnode3 .
?gpnode1 rdf:type ?gp1 .
?gpnode2 rdf:type ?gp2 .
?gpnode3 rdf:type ?gp3 .
FILTER(?gp1 = <` + id + `> || ?gp2 = <` + id + `> || ?gp3 = <` + id + `>)
?ind1 ?causal ?ind2 .
?ind2 ?causal2 ?ind3 .
?gpnode1 rdf:type ?gp1 .
?gpnode2 rdf:type ?gp2 .
?gpnode3 rdf:type ?gp3 .
# Inject gene product ID here
FILTER(?gp1 = <http://identifiers.org/rgd/1586460> || ?gp2 = <http://identifiers.org/rgd/1586460> || ?gp3 = <http://identifiers.org/rgd/1586460>)
}
FILTER EXISTS {
?ind1 rdf:type MF: .
}
FILTER EXISTS {
?ind2 rdf:type MF: .
}
FILTER EXISTS {
?ind3 rdf:type MF: .
}
?ind1 rdf:type MF: .
?ind2 rdf:type MF: .
?ind3 rdf:type MF:
}
ORDER BY ?gocam
`);
Expand Down

0 comments on commit 1224fee

Please sign in to comment.