Skip to content

Instantly share code, notes, and snippets.

@edsu
Created May 27, 2011 18:15
Show Gist options
  • Select an option

  • Save edsu/995811 to your computer and use it in GitHub Desktop.

Select an option

Save edsu/995811 to your computer and use it in GitHub Desktop.
silly command line tool to summarize type assertions in a batch of ntriples
#!/bin/sh
#
# pass this script a filename of ntriples data and get back a
# little report about the types of resources in the rdf, e.g.
#
# ed@curry:~/$ rdfsum oreily_catalog.nt
# 6803 <http://purl.org/goodrelations/v1#TypeAndQuantityNode>
# 5861 <http://purl.org/goodrelations/v1#Offering>
# 4564 <http://purl.org/goodrelations/v1#UnitPriceSpecification>
# 4065 <http://vocab.org/frbr/core#Manifestation>
# 2100 <http://vocab.org/frbr/core#Expression>
# 2023 <http://xmlns.com/foaf/0.1/Person>
#
grep 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' $1 \
| cut -f 3 -d " " \
| sort \
| uniq -c \
| sort -rn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment