Skip to content

Instantly share code, notes, and snippets.

@justin2004
Last active November 2, 2023 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justin2004/e89b3ecb257acd9f10475216a82e5c3d to your computer and use it in GitHub Desktop.
Save justin2004/e89b3ecb257acd9f10475216a82e5c3d to your computer and use it in GitHub Desktop.
github issues as RDF
first run SPARQL Anything (https://github.com/SPARQL-Anything/sparql.anything) as a
service then you can invoke a SPARQL query as demonstrated below.
you can also run SPARQL Anything not as a service but 1 query at a time
e.g. `java -jar sparql-anything.jar --query some.rq`
curl --silent 'http://localhost:3000/sparql.anything' \
--header "Accept: text/csv" \
--data-urlencode 'query=
PREFIX xyz: <http://sparql.xyz/facade-x/data/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX fx: <http://sparql.xyz/facade-x/ns/>
PREFIX ex: <http://example.com/>
CONSTRUCT
{
?s ?p ?o .
}
WHERE
{ SERVICE <x-sparql-anything:>
{ fx:properties
fx:location "https://api.github.com/repos/phantomics/april/issues?state=all&per_page=100&page=1" ;
fx:media-type "application/json" .
?s ?p ?o
}
}
'
which produces:
@prefix ex: <http://example.com/> .
@prefix fx: <http://sparql.xyz/facade-x/ns/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix xyz: <http://sparql.xyz/facade-x/data/> .
[ a fx:root ;
<http://www.w3.org/1999/02/22-rdf-syntax-ns#_1>
[ xyz:assignees [] ;
xyz:author_association "NONE" ;
xyz:body "Hey, just noticed something else with :store-fun:\r\n\r\n```\r\n(april:april\r\n (with (:state :in ((a 10) (b 20)))\r\n (:store-fun (bool (lambda (x) (not (zerop x))))))\r\n \"bool (a≡b)\")\r\n```\r\n\r\nyields\r\n\r\n```\r\nThe value\r\n #<VARRAY:VADER-COMPARE {100AB233E3}>\r\nis not of type\r\n NUMBER\r\n [Condition of type TYPE-ERROR]\r\n\r\nRestarts:\r\n 0: [RETRY] Retry SLY mREPL evaluation request.\r\n 1: [*ABORT] Return to SLY's top level.\r\n 2: [ABORT] abort thread (#<THREAD tid=586505 \"sly-channel-1-mrepl-remote-1\" RUNNING {10015D8003}>)\r\n\r\nBacktrace:\r\n 0: (SB-KERNEL:TWO-ARG-= #<VARRAY:VADER-COMPARE {100AB233E3}> 0)\r\n 1: (SB-VM::GENERIC-=)\r\n 2: ((LAMBDA (X)) #<VARRAY:VADER-COMPARE {100AB233E3}>)\r\n 3: ((LAMBDA ()))\r\n 4: (SB-INT:SIMPLE-EVAL-IN-LEXENV (APRIL:APRIL (WITH (:STATE :IN #) (:STATE :UNFORMAT-OUTPUT T) (:STORE-FUN #)) \"bool (a≡b)\") #<NULL-LEXENV>)\r\n 5: (EVAL (APRIL:APRIL (WITH (:STATE :IN #) (:STATE :UNFORMAT-OUTPUT T) (:STORE-FUN #)) \"bool (a≡b)\"))\r\n```" ;
xyz:closed_at "2023-10-23T19:41:58Z" ;
xyz:comments "4"^^xsd:int ;
xyz:comments_url "https://api.github.com/repos/phantomics/april/issues/276/comments" ;
xyz:created_at "2023-10-23T12:32:58Z" ;
xyz:events_url "https://api.github.com/repos/phantomics/april/issues/276/events" ;
xyz:html_url "https://github.com/phantomics/april/issues/276" ;
xyz:id "1957057849"^^xsd:int ;
xyz:labels [] ;
xyz:labels_url "https://api.github.com/repos/phantomics/april/issues/276/labels{/name}" ;
xyz:locked false ;
xyz:node_id "I_kwDOBtzVPc50plU5" ;
xyz:number "276"^^xsd:int ;
xyz:reactions [ <http://sparql.xyz/facade-x/data/%2B1>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment