#
# example SPARQL query 131
#

@prefix schema: <https://schema.org/> . 
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . 
@prefix sh: <http://www.w3.org/ns/shacl#> . 
@prefix cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/> .


cello:Query_131 a sh:SPARQLExecutable ;
    sh:prefixes _:sparql_examples_prefixes ;
    rdfs:comment """Cell lines with at least one publication prior to 1970"""@en ; 
    schema:keywords "publication" , "year" ; 
    schema:target <https://sparql.cellosaurus.org/sparql> ; 
    sh:select """
PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
select ?cl ?cl_name ?ref_class ?in_year ?year ?id ?title_shortened where {
  ?cl cello:derivedFromIndividualBelongingToSpecies / cello:isIdentifiedByXref ?species_xref .
  ?species_xref cello:more_specific_than* / skos:notation "50557" . # Insecta in NCBI_TaxID
  ?cl cello:recommendedName ?cl_name .
  ?cl cello:references ?ref .
  ?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,80) as ?title_shortened)
  filter (str(?year) < "1970" )
}
order by ?year
limit 100
    """
    .

