sparql-examples

A set of SPARQL examples that are used in different SIB resources

View the Project on GitHub sib-swiss/sparql-examples

27

Find all names associated with UniProtKB entry P05067, and if the name is associated with the entry it's domains or its components Retrieve all protein names, including peptide names, associated with UniProtKB entry P05067.

Use at

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT
  ?protein
  ?anyKindOfName 
  ?names 
  ?partType
WHERE
{
  BIND(<http://purl.uniprot.org/uniprot/P05067> AS ?protein)
  ?protein a up:Protein .
  {
    ?protein (up:recommendedName|up:alternativeName) ?structuredName .
  }
    UNION
  {
    VALUES(?partType){(up:domain) (up:component)}
    ?protein ?partType ?part .
    ?part (up:recommendedName|up:alternativeName) ?structuredName .
  }
  ?structuredName ?anyKindOfName  ?names .
  ?anyKindOfName rdfs:subPropertyOf up:structuredNameType .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?anyKindOfName"):::projected 
  v6("?names"):::projected 
  v4("?part")
  v3("?partType"):::projected 
  v1("?protein"):::projected 
  v2("?structuredName")
  c6(["up:structuredNameType"]):::iri 
  c2(["up:Protein"]):::iri 
  bind0[/"http://purl.uniprot.org/uniprot/P05067"/]
  bind0 --as--o v1
  v1 --"a"-->  c2
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    bind1[/VALUES ?partType/]
    bind1-->v3
    bind10(["up:domain"])
    bind10 --> bind1
    bind11(["up:component"])
    bind11 --> bind1
    v1 -->v3--> v4
    subgraph union1[" Union "]
    subgraph union1l[" "]
      style union1l fill:#abf,stroke-dasharray: 3 3;
      v4 --"up:alternativeName"-->  v2
    end
    subgraph union1r[" "]
      style union1r fill:#abf,stroke-dasharray: 3 3;
      v4 --"up:recommendedName"-->  v2
    end
    union1r <== or ==> union1l
    end
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    subgraph union2[" Union "]
    subgraph union2l[" "]
      style union2l fill:#abf,stroke-dasharray: 3 3;
      v1 --"up:alternativeName"-->  v2
    end
    subgraph union2r[" "]
      style union2r fill:#abf,stroke-dasharray: 3 3;
      v1 --"up:recommendedName"-->  v2
    end
    union2r <== or ==> union2l
    end
  end
  union0r <== or ==> union0l
  end
  v2 -->v5--> v6
  v5 --"rdfs:subPropertyOf"-->  c6