Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sparql query formatting #13

Open
justin2004 opened this issue May 2, 2021 · 2 comments
Open

sparql query formatting #13

justin2004 opened this issue May 2, 2021 · 2 comments

Comments

@justin2004
Copy link

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>
  }
@justin2004
Copy link
Author

and i bet if you prepend prefixes it'll shorten the URIs

@cmungall
Copy link
Owner

cmungall commented May 5, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants