A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/willowsystems/rRDFj.js below:

willowsystems/rRDFj.js: JavaScript parser, manipulator of "Reduced RDF as JSON" formatted data.

This JavaScript library is a helper library making it easier to work with, parse, filter, extract data from rRDFj - "Reduced RDF as JSON" data format.

For introduction to rRDFj (rRDFj-formatted triples object) see:

Because of the simplicity of the data storage format, the rRDFj triples can be parsed rather easily with JavaScript's Array.prototype.forEach and Object.keys(). However, helper libraries that assist in iteration over the data points, make the job of sqeezing data out of rRDFj less mandane. Underscore.js is one of those helpful libraries, providing useful iteration methods like .map(), .each(), filter(), sort(). This library builds on top of Underscore to provide most efficient iterative structures that work reliably on all platforms Underscore supports. This library provides further comfort to parsing rRDFj by making the flow chainable, jQuery-like experience.

You start by encapsulating the dataset into the rRDFj object.

var triples_data_object : {
    'Human_US_ID000-00-1111':{
        'Name': 'Joe Shmoe'
        , 'Friend': ['Human_US_ID000-00-9999','Dog_UUID000000000011']
    }
    'Human_US_ID000-00-9999':{
        'Type':'Type_ID01'
        , 'Name': 'Sue Shmoe'
        , 'Friend': 'Human_US_ID000-00-1111'
    }
    'Type_ID01':{
        'Label':'Human Female'
        , 'Description':'The prettier one. That one that is always right.'
    }
}
, d = rRDFj(triples_data_object)

The following methods become exposed to you on top of "d":

See tests for more examples.

Adding rRDFj.js to your page

Since this library builds upon Underscore.js, you need to expose rRDFj to Underscore.js

The library can be pulled into the page as regular script:

<script src="path/to/underscore.js"></script>
<script src="path/to/rrdfj.js"></script>

Or as AMD-compatible module:

// rRDFj internally require( ['underscore']
// make sure you have set the path to 'underscore' in your config or defined it as such ahead of time.
require(['rrdfj'], function(rRDFj){
    var d = rRDFj(mydataobject)
    ...
})

MIT License

See source header for full and most current Copyright attributions.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4