diff --git a/sparql/cell_by_location.rq b/sparql/cell_by_location.rq index 89081f4..0cfa663 100644 --- a/sparql/cell_by_location.rq +++ b/sparql/cell_by_location.rq @@ -1,19 +1,24 @@ -#+ summary: Find cells by location -#+ description: Enter an anatomical location, get back a list of cell type IRIs and labels +#+ summary: Find cells by type and location +#+ description: Args: cell: the iri or a cell type; location: the iri of an anatomical location. All args are optional. With no args returns all cells with an anatomical location. Location is a union of part_of (suitable for location of most cells) and has_soma_location (used for neurons). This pattern is designed for safe grouping of cell annotations. Returns: a 2 column table: cell (type) IRIs and cell (type) labels. #+ defaults: -#+ - location: http://purl.obolibrary.org/obo/UBERON_0002113 +#+ - location: http://purl.obolibrary.org/obo/UBERON_0001062 # Anatomical Entity +#+ - cell: http://purl.obolibrary.org/obo/CL_0000000 # Cell PREFIX rdfs: PREFIX owl: -PREFIX overlaps: +PREFIX part_of: PREFIX cell: +PREFIX has_soma_location: SELECT DISTINCT ?cell_iri (STR(?qlabel) as ?cell_label) WHERE { - ?cell_iri overlaps: ?_location_iri . - ?cell_iri rdfs:subClassOf cell: . - ?cell_iri rdfs:label ?qlabel . + { + ?cell_iri part_of: ?_location_iri . + } UNION { + ?cell_iri has_soma_location: ?someValue . } - + ?cell_iri rdfs:subClassOf ?_cell_iri . + ?cell_iri rdfs:label ?qlabel . +}