This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XQueryCall.run("""declare namespace mp='http://musicpath.org'; | |
declare namespace r='http://www.w3.org/2005/sparql-results#'; | |
mp:sparql('SELECT * WHERE {<http://musicpath.org/people/melissa> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?t }')//r:result[1]""") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import module namespace _xsparql = "http://xsparql.deri.org/XSPARQLer/xsparql.xquery" | |
at "http://xsparql.deri.org/XSPARQLer/xsparql.xquery"; | |
declare namespace mp = "http://musicpath.org" ; | |
declare namespace _sparql_result = "http://www.w3.org/2005/sparql-results#"; | |
declare namespace foaf = "http://xmlns.com/foaf/0.1/" ; | |
declare variable $_NS1 := "prefix foaf: <http://xmlns.com/foaf/0.1/>"; | |
<html> <head> </head><body> { | |
let $_aux1 := _xsparql:_serialize(( $_NS1, " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
roqet schema_diagram.sparql -r dot -D $1 | dot -Tsvg -o pic.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/pxsl | |
stylesheet -version=1.0 -xmlns:xsl=http://www.w3.org/1999/XSL/Transform -xmlns=http://xmlns.com/foaf/0.1/ -xmlns:bio=http://purl.org/vocab/bio/0.1/ -xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# -xmlns:rdfs=http://www.w3.org/2000/01/rdf-schema# -xmlns:epdx=http://epdx.org/schema | |
import util.xsl | |
output -indent=yes | |
template / | |
rdf:RDF | |
rdf:Description -rdf:about=http://twitter.com -rdfs:label=Twitter | |
rdf:Description -rdf:about=http://github.com -rdfs:label=GitHub | |
apply-templates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Call this on e.g. http://github.com/api/v2/xml/repos/show/leifw | |
stylesheet -xmlns:xsl=http://www.w3.org/1999/XSL/Transform -version=1.0 | |
output -method=text | |
template repository | |
text << | |
>> | |
apply-templates name | |
apply-templates document(concat(owner,'/',name,'/languages'),.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Earlier I said Haskell/Scala/Python/Ruby/CoffeeScript are all pretty much the same. | |
By that I meant you can write much the same code in all of them, just the syntax might look a bit more weird or arbitrary in some cases. | |
Of course there are fundamental differences in the type of things you write in static versus dynamic languages, just as there are fundamental differences between what you write in a lazy vs eager language. | |
Print the numbers one through ten: | |
Python: | |
for i in range(1,11): | |
print(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
header("Accept").flatMap( | |
_.split(','). | |
map( | |
_.trim.split(';') match { | |
case Array(t) => 1F -> t | |
case Array(t, q) => q.split('=')(1).toFloat -> t | |
} | |
). | |
sortWith(_._1 > _._1). | |
map( _._2 ). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.scardf._ | |
object Treeify { | |
def localName(res:UriRef) = ".*[#/]".r.split(res.uri)(1) | |
def apply(start:GraphNode) = { | |
val graph = start.graph | |
def treeify(subject:SubjectNode, visited:Set[SubjectNode]):Map[String,Any] = Map( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("*").map(function(){return $.grep(this.attributes, function(a){return a.name.slice(0,5) === "xmlns"})}) |