iprd
v0.4.1
Published
interplanetary resource descriptions
Downloads
14
Readme
iprd
interplanetary resource descriptions
Link descriptions and data using RDF and IPLD with the rdfc-1.0
(w3.org TR) multicodec (46803
).
Usage
CLI
ni:
⚡ echo '{"http://www.w3.org/1999/02/22-rdf-syntax-ns#value":42}' | iprd ni
ni:///sha-256;GoqdAH6MNX2ddN2HVm5ZdENQdDcPgxPzjJo2CRSSCDk?ct=application%2Fn-quads
⚡ echo '{"http://www.w3.org/1999/02/22-rdf-syntax-ns#value":[42]}' | iprd ni
ni:///sha-256;GoqdAH6MNX2ddN2HVm5ZdENQdDcPgxPzjJo2CRSSCDk?ct=application%2Fn-quads
web+ipfs:
⚡ echo '{"http://www.w3.org/1999/02/22-rdf-syntax-ns#value":[42]}' | iprd 'web+ipfs'
web+ipfs://bagb6qaqseanivhiap2gdk7m5otoyovtolf2egudug4hyge7trsndmciusieds
cid
⚡ echo '{"http://www.w3.org/1999/02/22-rdf-syntax-ns#value":42}' | iprd cid
bagb6qaqseanivhiap2gdk7m5otoyovtolf2egudug4hyge7trsndmciusieds
⚡ echo '{"http://www.w3.org/1999/02/22-rdf-syntax-ns#value":[42]}' | iprd cid
bagb6qaqseanivhiap2gdk7m5otoyovtolf2egudug4hyge7trsndmciusieds
car
⚡ echo '{"http://www.w3.org/1999/02/22-rdf-syntax-ns#value":42}' | iprd car
wrote car to
bagb6qaqsean7cqjqfrw3mt23udnwyqhm2744tvihfrst4qpvv7fc3nihpkagk.car
JavaScript
import iprd from 'iprd'
import assert from 'node:assert'
import { sha256 } from 'multiformats/hashes/sha2'
import { CID } from 'multiformats/cid'
const doc = {
"@context": "https://www.w3.org/ns/activitystreams",
"summary": "A note",
"type": "Note",
"content": "My dog has fleas."
}
const bytes = await iprd.encode(doc)
const cid = CID.create(...await iprd.cid(bytes, sha256))
assert.equal(cid.toString(), 'bagb6qaqsec5ogmlqpjmin5ihtpxg3qxkxdfap6cwrxa3vymwi3hghvz4gy5fe')
IPFS-LD
https://github.com/ipfs/ipfs/issues/36
The power of the semantic web is worth considering. While it hasn't really "taken off," it's TRTTD when it comes to data structuring.
@msporny created the wonderfully simple JSON-LD. Since IPFS is a tree dag structure, the JSON-LD spec (or a simplified version of it) might fit IPFS really, really well. This would give IPFS all the power of the semantic web with very little overhead.
@[email protected] 2014-09-19, https://github.com/ipfs/ipfs/issues/36
an ipfs object is a tree like json or anything else. this means that all the solutions available to JSON (inc JSON-LD, JSON-schema, and so on) are available to IPFS. moreover, it is trivial to represent RDF triples as ipfs objects. hence, you can do anything and everything.
real data is very messy. nobody in the world has succeed in forcing people to adopt a particular data typing system-- and i'm not going to sink time into those arguments. The only solution i think is viable in the long term is to make a system flexible enough for people to do whatever they want, and just rigid enough so everything interlinks.
now, the preferred way -- the way we'll suggest people do things -- is likely going to be the @context / @type from the (amazingly powerful and simple) JSON-LD.
@[email protected] 2015-05-01, https://github.com/ipfs/ipfs/issues/36
TRTTD
The Right Thing To Do