#Datatypes
##Functions
When call a function with only some of its arguments, you get back a partially-applied function that only expects the remainding arguments: const add1 = R.add(1) // function add1(){...
// submit :: event -> IO[ HttpGet[ Either [ HttpPost []]]] | |
const submit = (event) => { | |
return getFormFields() | |
.map(incrementVersionNumber) | |
.map(saveRecord) | |
} | |
// getFormFields :: () -> IO | |
const getFormFields = () => IO(()=>{ | |
return lift() |
map(f,g)(x) //map(pipe(f,g), x) | |
filter(f,g)(x) //filter(allPass(f,g), x) | |
pipeP(f,g)(handleError)(x) //pipe(pipeP(f,g), p=>p.catch(handleError))(x) | |
cond([f1,a1], [f2,a2])(x) //cond([[f1,a1], [f2,a2]], x) |
// httpGET :: url -> HttpGET | |
const httpGET = (url) => { | |
let transform = x => x | |
const GET = { | |
url: url, | |
map: (f) => { | |
transform = x => f(transform(x)) | |
return GET | |
}, | |
fork: (reject,resolve) => { |
var prepend = first => second => first + second | |
, prefix = (item, i) => `@prefix n${i}: <${item}> . \n` | |
, mapI = R.addIndex(R.map) | |
, insertIndex = (ns,uri) => ns.push(uri)-1 | |
, nsEnd = uri => Math.max(uri.lastIndexOf('#'), uri.lastIndexOf('/')) +1 | |
, lookup = ns => uri => { const i = ns.indexOf(uri); return 'n' + (i>-1)? i : insertIndex(ns,uri) } | |
, change0 = R.over(R.lensIndex(0)) | |
, change1 = R.over(R.lensIndex(1)) | |
, literal = ({value,lang,datatype}) => '"'+ value.replace(/("|\n)/g,'\\$1') + '"'+langTag(lang)+dataType(datatype) | |
, langTag = lang => lang? '@'+lang : '' |
@prefix R: <npm:ramda/0.18.0> . #(made up) npm protocol to define the module as a namespace | |
@prefix r: <http://www.w3.org/2000/01/rdf-schema#> . | |
@prefix : <#> . #this will be the namespace defining the lang-specific terms like :Text, :Fun1 | |
@prefix owl: <#...> . #whatever the owl prefix is... | |
#functions are relationships, aka predicates, aka properties, between inputs and outputs | |
:STDOUT <app> :STDIN . | |
#owl:propertyChainAxiom is a composition of properties/predicates | |
<app> owl:propertyChainAxiom ( |
{"C0":16.35," C#0/Db0 ":17.32,"D0":18.35," D#0/Eb0 ":19.45,"E0":20.6,"F0":21.83," F#0/Gb0 ":23.12,"G0":24.5," G#0/Ab0 ":25.96,"A0":27.5," A#0/Bb0 ":29.14,"B0":30.87,"C1":32.7," C#1/Db1 ":34.65,"D1":36.71," D#1/Eb1 ":38.89,"E1":41.2,"F1":43.65," F#1/Gb1 ":46.25,"G1":49," G#1/Ab1 ":51.91,"A1":55," A#1/Bb1 ":58.27,"B1":61.74,"C2":65.41," C#2/Db2 ":69.3,"D2":73.42," D#2/Eb2 ":77.78,"E2":82.41,"F2":87.31," F#2/Gb2 ":92.5,"G2":98," G#2/Ab2 ":103.83,"A2":110," A#2/Bb2 ":116.54,"B2":123.47,"C3":130.81," C#3/Db3 ":138.59,"D3":146.83," D#3/Eb3 ":155.56,"E3":164.81,"F3":174.61," F#3/Gb3 ":185,"G3":196," G#3/Ab3 ":207.65,"A3":220," A#3/Bb3 ":233.08,"B3":246.94,"C4":261.63," C#4/Db4 ":277.18,"D4":293.66," D#4/Eb4 ":311.13,"E4":329.63,"F4":349.23," F#4/Gb4 ":369.99,"G4":392," G#4/Ab4 ":415.3,"A4":440," A#4/Bb4 ":466.16,"B4":493.88,"C5":523.25," C#5/Db5 ":554.37,"D5":587.33," D#5/Eb5 ":622.25,"E5":659.25,"F5":698.46," F#5/Gb5 ":739.99,"G5":783.99," G#5/Ab5 ":830.61,"A5":880," A#5/Bb5 ":932.33,"B5":987.77,"C6":1046.5," C#6/D |
//getFieldDefinition :: key -> [a] -> a | |
var getFieldDefinition = r.useWith( | |
r.find, // #final function :: Relation -> [a] -> a | |
r.propEq(1), //takes `key` where [1]==key #function for 1st param | |
r.identity //#placeholder func for 2nd param | |
) | |
// getFieldSpec :: String -> Object | |
// getFieldSpec('duration') | |
// > {type:'number', max:60, min: 1} |
#Dynamic Linked Data
status: DRAFT,EXPERIMENTAL
Traditional Linked Data is not very "browsable" and does not provide a way to get from a resource to a list of things of the same type, or from a page about a book to a list of books by the same author.
SPARQL is a powerful query language, but it is difficult to write queries without knowledge of both the dataset, and SPARQL. It is not always practical to provide a SPARQL endpoint for every dataset that publishes as Linked Data.
This document describes a simple HTTP-based query system for Linked Data to fill the gap between static documents and SPARQL.
#Why
##Structure
The basic structure that Turtle is built on is Entity Attribute Value. An entity can be thought of as a named set of key-value pairs.