Skip to content

rrasmo/rdfcli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#rdfcli

rdfcli is a command-line Linked Data browser. It allows to visit RDF resources, see their links and follow them across different datasets. The user interface is based on a stateful command line, much like a shell to browse a file system.

It is similar in functionality to other RDF browsers like Disco or Tabulator, but limited to the basic features. When a resource is visited, the URI is dereferenced and the returned triples are loaded to the local graph. The user can then explore the outoing and incoming predicates of the current resource, and navigate to their objects or subjects.

rdfcli uses the Python rdflib library to handle RDF data.

##Installation

# clone repo
$ git clone git@github.com:rrasmo/rdfcli.git
$ cd rdfcli
# (optional) make a virtualenv
$ mkvirtualenv rdfcli
# install dependencies
$ pip install -r requirements.txt

##Usage

$ ./rdfcli/rdfcli.py
> help

Commands:

  load URI    # Load triples from URI or file.
  go URI      # Go to a resource and load related triples.
  size        # Print the number of triples in the graph.
  types       # List all types, i.e. objects of rdf:type.
  this        # Print the current resource.
  pred        # List all predicates of the current resource.
  ls [PRED]   # List outgoing predicates and objects. If a predicate is given, print the objects.
  fw PRED     # Follow outgoing predicate, go to the object.
  is [PRED]   # List incoming predicates and subjects. If a predicate is given, print the subjects.
  bw PRED     # Follow backwards incoming predicate, go to the subject.
  f           # Go forward in history
  b           # Go back in history
  hist        # Print history stack.
  help        # Print this help.
  exit        # Exit.

> go http://dbpedia.org/resource/Metallica
http://dbpedia.org/resource/Metallica> size
812
http://dbpedia.org/resource/Metallica> ls
    rdf:type
        dbpedia-owl:Band
    rdfs:label
        <Metallica>
    dbpedia-owl:bandMember
        <http://dbpedia.org/resource/James_Hetfield>
    ...
http://dbpedia.org/resource/Metallica> ls dbpedia-owl:bandMember
    <http://dbpedia.org/resource/Kirk_Hammett>
    <http://dbpedia.org/resource/James_Hetfield>
    <http://dbpedia.org/resource/Lars_Ulrich>
    <http://dbpedia.org/resource/Robert_Trujillo>
http://dbpedia.org/resource/Metallica> fw dbpedia-owl:bandMember
    0) http://dbpedia.org/resource/Kirk_Hammett
    1) http://dbpedia.org/resource/James_Hetfield
    2) http://dbpedia.org/resource/Lars_Ulrich
    3) http://dbpedia.org/resource/Robert_Trujillo
Select one resource: 0
http://dbpedia.org/resource/Kirk_Hammett> is
    is dbpprop:artist of
        <http://dbpedia.org/resource/Master_of_Puppets>
    is dbpedia-owl:bandMember of
        <http://dbpedia.org/resource/Metallica>
    ...
http://dbpedia.org/resource/Kirk_Hammett> is dbpedia-owl:bandMember
    <http://dbpedia.org/resource/Metallica>
http://dbpedia.org/resource/Kirk_Hammett> bw dbpedia-owl:bandMember
http://dbpedia.org/resource/Metallica> f
http://dbpedia.org/resource/Kirk_Hammett> b
http://dbpedia.org/resource/Metallica>

##Test

$ python -m unittest discover

About

Command-line RDF browser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages