Skip to content

Instantly share code, notes, and snippets.

@danbri
Created July 29, 2011 11:06
Show Gist options
  • Save danbri/1113620 to your computer and use it in GitHub Desktop.
Save danbri/1113620 to your computer and use it in GitHub Desktop.
g = new LinkedDataSailGraph(new MemoryStoreSailGraph())
g.addNamespace('dct', 'http://purl.org/dc/terms/')
g.addNamespace('dbpedia','http://dbpedia.org/resource/')
g.addNamespace('dbpedia-owl', 'http://dbpedia.org/ontology/')
labels = [g.uri('dbpedia-owl:presenter'), g.uri('dbpedia-owl:creator'), g.uri('dbpedia-owl:influences'), g.uri('dbpedia-owl:starring'),g.uri('dbpedia-owl:writer'), g.uri('owl:sameAs') ]
rand = new Random()
m = [:]
will = g.v('http://dbpedia.org/resource/William_Kamkwamba')
/*
will.out('dct:subject').in('dct:subject'){ rand.nextBoolean() } .out('dc:subject').groupCount(m).loop(4){it.loops<2}
m = m.sort{ a,b -> b.value <=> a.value }
m.subMap((m.keySet() as List)[0..20])
gremlin> m.subMap((m.keySet() as List)[0..20])
==>v[http://dbpedia.org/resource/Category:1987_births]=2020
==>v[http://dbpedia.org/resource/Category:Living_people]=1007
==>v[http://dbpedia.org/resource/Category:Inventors]=110
==>v[http://dbpedia.org/resource/Category:Association_football_midfielders]=72
==>v[http://dbpedia.org/resource/Category:Association_football_forwards]=52
==>v[http://dbpedia.org/resource/Category:Autobiographers]=49
==>v[http://dbpedia.org/resource/Category:The_Football_League_players]=45
==>v[http://dbpedia.org/resource/Category:English_footballers]=41
==>v[http://dbpedia.org/resource/Category:Association_football_defenders]=41
==>v[http://dbpedia.org/resource/Category:Association_football_goalkeepers]=29
==>v[http://dbpedia.org/resource/Category:Brazilian_footballers]=28
==>v[http://dbpedia.org/resource/Category:Italian_footballers]=20
==>v[http://dbpedia.org/resource/Category:Romanian_footballers]=19
==>v[http://dbpedia.org/resource/Category:Premier_League_players]=18
==>v[http://dbpedia.org/resource/Category:American_television_actors]=17
==>v[http://dbpedia.org/resource/Category:Russian_footballers]=16
==>v[http://dbpedia.org/resource/Category:Conference_National_players]=16
==>v[http://dbpedia.org/resource/Category:Brazilian_expatriate_footballers]=15
==>v[http://dbpedia.org/resource/Category:American_soccer_players]=15
==>v[http://dbpedia.org/resource/Category:Dutch_footballers]=14
==>v[http://dbpedia.org/resource/Category:American_film_actors]=14
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment