{"action":"created","issue":{"url":"https://api.github.com/repos/ekg/vg/issues/103","labels_url":"https://api.github.com/repos/ekg/vg/issues/103/labels{/name}","comments_url":"https://api.github.com/repos/ekg/vg/issues/103/comments","events_url":"https://api.github.com/repos/ekg/vg/issues/103/events","html_url":"https://github.com/ekg/vg/pull/103","id":106945457,"number":103,"title":"Syntactically correct RDF/JSON for vg (for discussion not for merging at this time)","user":{"login":"JervenBolleman","id":986133,"avatar_url":"https://avatars.githubusercontent.com/u/986133?v=3","gravatar_id":"","url":"https://api.github.com/users/JervenBolleman","html_url":"https://github.com/JervenBolleman","followers_url":"https://api.github.com/users/JervenBolleman/followers","following_url":"https://api.github.com/users/JervenBolleman/following{/other_user}","gists_url":"https://api.github.com/users/JervenBolleman/gists{/gist_id}","starred_url":"https://api.github.com/users/JervenBolleman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JervenBolleman/subscriptions","organizations_url":"https://api.github.com/users/JervenBolleman/orgs","repos_url":"https://api.github.com/users/JervenBolleman/repos","events_url":"https://api.github.com/users/JervenBolleman/events{/privacy}","received_events_url":"https://api.github.com/users/JervenBolleman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-09-17T09:30:10Z","updated_at":"2015-09-24T20:17:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ekg/vg/pulls/103","html_url":"https://github.com/ekg/vg/pull/103","diff_url":"https://github.com/ekg/vg/pull/103.diff","patch_url":"https://github.com/ekg/vg/pull/103.patch"},"body":"This pull request is not ready for accepting, but I open it as a starting point for further discussion.\r\n\r\nThe aim is to have the Variation Graph in an RDF serialisation so that SPARQL/Triplestore databases can load the variation graph and SPARQL queries can be executed on it.\r\n\r\nThe shell script uses a multitude of jq and sed scripts to translate the JSON output into RDF/JSON as used by the apache jena project. This [RDF/JSON](http://jena.apache.org/documentation/io/rdf-json.html) can then be translated or loaded directly into any SPARQL/RDF store.\r\n\r\nIncluding the rather slow, but useful for testing, jena commandline sparql tool.\r\ne.g. translate the vg json to n-triples and then use SPARQL to rebuild the linear dna sequence for a path.\r\n```\r\nvgtordf.sh x.json | riot --syntax=\"RDF/JSON\" --output=\"N-Triples\" > x.nt\r\nsparql --data x.nt \r\n\"PREFIX :<http://base/> PREFIX rdf:<ttp://www.w3.org/1999/02/22-rdf-syntax-ns#> \r\n SELECT ?path (group_concat(?sequence; separator='') as ?pathSeq)\r\n WHERE {?step :path ?path; \r\n              :node ?node ;\r\n              :step ?order.\r\n        ?node rdf:value ?sequence} \r\n GROUP BY ?path \r\n ORDER BY ?order\"\r\n```\r\nOn the same data one can do for example to give the average \"node\" sequence length.\r\n```\r\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>SELECT (avg(?len) as ?avglen) WHERE  { ?x  rdf:value ?s . BIND (strlen(?s) as ?len)}\r\n```\r\n\r\nThe RDF is syntactically correct, but is only useable as a demo that the technology \"works\". i.e. wrong URI's are generated etc...\r\n\r\nRDF/JSON is not a standardised format, JSON-LD would normally be the preferred solution for having a Semantic Web view on existing JSON. As far as I understand JSON-LD can not be used here as \"IDs\" are implicit indexes in JSON arrays.\r\n\r\nOtherwise this small script touches upon some of the questions raised in https://github.com/ga4gh/schemas/issues/287, i.e. should there be a focus on data instead of on API's.\r\nEspecially taking into account that while we can have a SPARQL interface data does not need to be stored in a RDF database. For now it means that this data can be stored into content addressable RDF stores such as dydra."},"comment":{"url":"https://api.github.com/repos/ekg/vg/issues/comments/143039301","html_url":"https://github.com/ekg/vg/pull/103#issuecomment-143039301","issue_url":"https://api.github.com/repos/ekg/vg/issues/103","id":143039301,"user":{"login":"JervenBolleman","id":986133,"avatar_url":"https://avatars.githubusercontent.com/u/986133?v=3","gravatar_id":"","url":"https://api.github.com/users/JervenBolleman","html_url":"https://github.com/JervenBolleman","followers_url":"https://api.github.com/users/JervenBolleman/followers","following_url":"https://api.github.com/users/JervenBolleman/following{/other_user}","gists_url":"https://api.github.com/users/JervenBolleman/gists{/gist_id}","starred_url":"https://api.github.com/users/JervenBolleman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JervenBolleman/subscriptions","organizations_url":"https://api.github.com/users/JervenBolleman/orgs","repos_url":"https://api.github.com/users/JervenBolleman/repos","events_url":"https://api.github.com/users/JervenBolleman/events{/privacy}","received_events_url":"https://api.github.com/users/JervenBolleman/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T20:17:47Z","updated_at":"2015-09-24T20:17:47Z","body":"Ok found a json file for testing that generates a correct json file. The test pases on my mac os x laptop and validates the script can read the json vg view -j produces and produces valid json as well.\r\nRequires a recent bash to run as it uses the nice job substitution syntax.\r\nNoticed that if a path edge or nodes list is missing this script won't work.\r\nProbably easiest long term is to for us to sit together and make the C++ code do the work"}}