Giter VIP home page Giter VIP logo

ldget's Introduction

ldget

Build Status GitHub PRs Welcome

A simple command line interface tool to get RDF items using HTTP GET requests.

asciicast

When should you use this?

  • You need RDF data as Stdout.
  • Write bash scripts that use linked data.ldget
  • Check triple values from inside your terminal.
  • Testing your linked data service.
  • Get data from your Solid pod.

Installation

  • On MacOS using homebrew: $ brew tap ontola/ldget https://github.com/ontola/ldget.git && brew install ontola/ldget/ldget
  • Or install the binaries from the releases page
  • Or build it yourself. Install golang, clone this repo and run go get ./... && go install to install the dependencies and add ldget to path.

Usage

COMMANDS:
     triples, t            Fetch an RDF resource, return the triples. Serialized as N-Triples.
     predicates, p         Fetch an RDF resource, return the predicates.
     objects, o            Fetch an RDF resource, return the objects.
     subjects, s           Fetch an RDF resource, return the subjects.
     predicateObjects, po  Fetch an RDF resource, return the predicate and object values.
     prefixes              Shows your user defined prefixes from  `~/.ldget/prefixes`.
     expand, x             Expands any prefix. `ldget x schema` => https://schema.org/
     help, h               Shows a list of commands or help for one command

Use ?s ?p ?o to filter by %{subject URL} %{predicate URL} %{object value}. This is similar to Triple Pattern Fragments.

If you want to fetch a URL, but do not want to filter by it's subject, you can use the --resource flag:

ldget triples --resource http://example.com/myResourceURL Returns all triples for that resource as N-Triples.

Use the . character as a wildcard. For example, if you want to get all triples for subject http://example.com/X with an object value of "Value", use:

$ ldget triples http://example.com/X . "Value"

Prefixes

URLs are awesome, but they are cumbersome to remember and type. You can specify a set of prefixes in ~/.ldget/prefixes for mapping URLs to shorthands.

schema=http://schema.org/
joep=https://argu.co/argu/u/joep

$ ldget objects joep schema:description

Test

  • $ go test

Credits

Written by Joep Meindertsma.

Most of the hard work is done by the guys at Knakk, who wrote this awesome RDF library for Go.

ldget's People

Contributors

goreleaserbot avatar joepio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ldget's Issues

Custom serialization with flag

Maybe add an optional flag that takes a supported RDF mimeType to pick a serialization format for responses. Currenlty, it just serializes to NTriples.

ldget t example:thing --serialize=ttl

Add default prefixes

For things like Schema, RDF, FOAF etc. Maybe simply create the file if it does not exist on initialization.

Prefixes in args

Currently, the prefixes file is loaded multiple times. Let's put it in Args, import it on initializeArgs

Add human readable serialization option

The triples command always shows the subject, but in most responses, the user already knows the subject. We could introduce a new command, e.g. PredicateObject (po) that does not print out the subject for each triple.

ldget po orid:20
<somePredicate> "SomeObject"

Add getGraph / getResource function

Sometimes, the subject does not match with the fetch url. Currently, I need to do this to see all triples for some RDF document (i.e. graph / resource).

ldget t . . . --r=https://id.openraadsinformatie.nl/44477

I could add a resource function, which should return all triples.

ldget resource https://id.openraadsinformatie.nl/44477

Maybe ldget graph is a better name.

Rename Resource to Graph

The --resource flag is used for explicitly setting a URL to fetch. In RDF land, this is usually referred to as "graph" or "document", but not "resource". A rename would be fitting.

SPARQL support

A lot of linked data resources unfortunately have URLs that don't resolve properly - they're only available on SPARQL endpoints.

It might make sense to add support for this. Perhaps add a custom flag for a SPARQL endpoint.

Test prefixes functionality

The prefixes file is included in the /testing dir, but is not used in tests.

This requires using a custom prefixes file.

Publish to snap store

Although most of the Snap config is set up, I need to fix the permissions, since I need read access to a specific folder (~/.ldget/prefixes) using the personal-files interface. This might serve as an example for how to request the snapcraft reviewers.

The Store automatic review failed.
A human will soon review your snap, but if you can't wait please write in the snapcraft forum asking for the manual review explicitly.
If you need to disable confinement, please consider using devmode, but note that devmode revision will only be allowed to be released in edge and beta channels.
Please check the errors and some hints below:
  - override not found for 'plugs/personal-files'. Use of the personal-files interface is reserved for vetted publishers. If your snap legitimately requires this access, please make a request in the forum using the 'store-requests' category (https://forum.snapcraft.io/c/store-requests), or if you would prefer to keep this private, the 'sensitive' category.
  - human review required due to 'allow-installation' constraint (bool)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.