Skip to content

sparql query formatting #13

@justin2004

Description

@justin2004

note: indentation and URI shortening are on the cards for future releases.

just wanted to share that there is a command line utility in apache jena that can do the sparql query formatting.

e.g.

justin@parens:/tmp$ cat a.sparql 
SELECT ?g ?h WHERE {?g <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/SO_0001217> . ?g <http://biohackathon.org/resource/faldo#location> ?l . ?l <http://biohackathon.org/resource/faldo#begin> ?v0 . ?v0 <http://biohackathon.org/resource/faldo#position> ?b . ?v0 <http://biohackathon.org/resource/faldo#reference> <http://rdf.ebi.ac.uk/resource/ensembl/90/mus_musculus/GRCm38/11> . ?l <http://biohackathon.org/resource/faldo#end> ?v1 . ?v1 <http://biohackathon.org/resource/faldo#position> ?e . ?v1 <http://biohackathon.org/resource/faldo#reference> <http://rdf.ebi.ac.uk/resource/ensembl/90/mus_musculus/GRCm38/11> . FILTER (?b >= 101100523) . FILTER (?e <= 101190725) . ?g <http://semanticscience.org/resource/SIO_000558> ?h . ?h <http://purl.obolibrary.org/obo/RO_0002162> <http://identifiers.org/taxonomy/9606>}
justin@parens:/tmp$ 
justin@parens:/tmp$ qparse --query a.sparql 
SELECT  ?g ?h
WHERE
  { ?g   a                     <http://purl.obolibrary.org/obo/SO_0001217> ;
         <http://biohackathon.org/resource/faldo#location>  ?l .
    ?l   <http://biohackathon.org/resource/faldo#begin>  ?v0 .
    ?v0  <http://biohackathon.org/resource/faldo#position>  ?b ;
         <http://biohackathon.org/resource/faldo#reference>  <http://rdf.ebi.ac.uk/resource/ensembl/90/mus_musculus/GRCm38/11> .
    ?l   <http://biohackathon.org/resource/faldo#end>  ?v1 .
    ?v1  <http://biohackathon.org/resource/faldo#position>  ?e ;
         <http://biohackathon.org/resource/faldo#reference>  <http://rdf.ebi.ac.uk/resource/ensembl/90/mus_musculus/GRCm38/11>
    FILTER ( ?b >= 101100523 )
    FILTER ( ?e <= 101190725 )
    ?g  <http://semanticscience.org/resource/SIO_000558>  ?h .
    ?h  <http://purl.obolibrary.org/obo/RO_0002162>  <http://identifiers.org/taxonomy/9606>
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions