Skip to content

Instantly share code, notes, and snippets.

@chrpr
chrpr / README.md
Created September 28, 2017 22:52
Pygotham Citing Sentences Bigrams by Sentence
@chrpr
chrpr / README.md
Created April 12, 2016 22:47
Wordcount Fingerprints, with log values for scale
@chrpr
chrpr / README.md
Last active April 12, 2016 22:11
Metadata Fingerprints: Average Count
@chrpr
chrpr / pcdm.ttl
Last active December 2, 2021 09:21
PCDM as Turtle
charper:~$ rapper -i rdfxml -o turtle models.rdf -O https://raw.githubusercontent.com/duraspace/pcdm/master/models.rdf
rapper: Parsing URI file:///home/charper/models.rdf with parser rdfxml
rapper: Serializing with serializer turtle and base URI https://raw.githubusercontent.com/duraspace/pcdm/master/models.rdf
@base <https://raw.githubusercontent.com/duraspace/pcdm/master/models.rdf> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@chrpr
chrpr / README.md
Last active February 22, 2016 16:20
Zoomable NYPL Bigram Frequencies
@chrpr
chrpr / README.md
Last active December 3, 2015 17:52
Zoomable ISIS Bigram Frequencies
@chrpr
chrpr / gist:23926c4650ce4363c51b
Created February 24, 2015 22:22
Example to grab predicate counts from a sparql endpoint

Since @mjg shamed me into posting a gist of this, here's a simple example of something gross.

Query dbpedia endpoint for most highly used properties, get the jq response format, grab the counts and values, format them usefully in sed, filter out the top 50 in awk, and print to the screen:

curl -H 'Accept: application/sparql-results+json' -d 'query=SELECT+?p+(COUNT+(?p)+AS+?pCount)+WHERE+{+?s+?p+?o+}+GROUP+BY+?p+ORDER+BY+DESC(?pCount)' http://dbpedia.org/sparql? | jq '.results.bindings[] | [.p.value, "|", .pCount.value] | add' | sed 's/"//g' | awk ' BEGIN { FS = "|" ; OFS = "|" } { if ($2 >= 50) { print $0 } } ' | less