sparql-examples

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

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

Query_133

rq turtle/ttl

Title, year and type of publication referenced by some cell lines

Use at


PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX fabio: <http://purl.org/spar/fabio/>
select ?cl ?cl_name ?ref_class ?in_year ?id ?title_shortened where {
  ?cl a / rdfs:subClassOf cello:CellLine .
  ?cl cello:recommendedName ?cl_name .
  ?cl cello:references ?ref .
  #values ?ref_class { fabio:ConferencePaper }  # uncomment to set constraint on reference class
  #values ?ref_class { fabio:JournalArticle }   # uncomment to set constraint on reference class
  ?ref a ?ref_class .
  ?ref cello:internalId ?id .
  ?ref cello:title ?title .
  ?ref cello:publicationYear ?year .
  bind(concat('in ', ?year) as ?in_year)
  bind(substr(?title,0,60) as ?title_shortened)
  #filter (strstarts(str(?id),"PubMed=") )     # uncomment to set constraint on internal id
  #filter (strstarts(str(?id),"DOI=") )        # uncomment to set constraint on internal id
  #filter (strstarts(str(?id),"Patent=") )     # uncomment to set constraint on internal id
  #filter (strstarts(str(?id),"CelloPub=") )   # uncomment to set constraint on internal id
}
limit 100
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?cl"):::projected 
  v2("?cl_name"):::projected 
  v5("?id"):::projected 
  v8("?in_year"):::projected 
  v3("?ref")
  v4("?ref_class"):::projected 
  v6("?title")
  v9("?title_shortened"):::projected 
  v7("?year")
  a1((" "))
  c3(["cello:CellLine"]):::iri 
  v1 --"a"-->  a1
  a1 --"rdfs:subClassOf"-->  c3
  v1 --"cello:recommendedName"-->  v2
  v1 --"cello:references"-->  v3
  v3 --"a"-->  v4
  v3 --"cello:internalId"-->  v5
  v3 --"cello:title"-->  v6
  v3 --"cello:publicationYear"-->  v7
  bind0[/"concat('in ',?year)"/]
  v7 --o bind0
  bind0 --as--o v8
  bind1[/"substring(?title,'0^^xsd:integer','60^^xsd:integer')"/]
  v6 --o bind1
  bind1 --as--o v9