Commit 3e6b3eec authored by Mikey's avatar Mikey
Browse files

basic read of namespace files

parent ee3c6627
......@@ -2,11 +2,13 @@ var gulp = require('gulp')
var Swig = require('swig').Swig
var data = require('gulp-data')
var markdown = require('markdown-it')()
var through = require('through2')
var map = require('through2-map')
var buffer = require('vinyl-buffer')
var replaceExt = require('replace-ext')
var assign = require('object-assign')
var prettify = require('gulp-prettify')
var push = Array.prototype.push
function docs () {
var swig = new Swig()
......@@ -38,8 +40,29 @@ function docs () {
}
function ns () {
gulp.src('./ns/*.jsonld')
// bundle into a single context at index.jsonld
.pipe(bundleContext())
.pipe(gulp.dest('./.build/ns'))
function bundleContext () {
var bundle = {
'@context': {},
'@graph': []
}
return through.obj(function bundleContext (file, enc, cb) {
console.log("contents", String(file.contents))
var context = JSON.parse(file.contents)
assign(bundle['@context'], context['@context'])
push.apply(bundle['@graph'], context['@graph'])
cb()
}, function writeContext (cb) {
console.log("context", bundle)
cb()
})
}
}
function css () {
......
{
"@context": [
{
"foaf": "http://xmlns.com/foaf/0.1/",
"vcard": "http://www.w3.org/2006/vcard/ns#",
"org": "http://www.w3.org/ns/org#",
"schema": "http://schema.org/",
"as": "http://www.w3.org/ns/activitystreams#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"owl": "http://www.w3.org/2002/07/owl#",
"rdfs:label": { "@container": "@language" },
"rdfs:comment": { "@container": "@language" },
},
{
"openvocab":
{
"@id": "openvocab.is#",
"@type": "owl:Ontology",
"owl:versionInfo": "0.1"
"rdfs:label": "Collaborative Economic Networks"@en;
},
"Agent": "foaf:Agent",
"Person": "foaf:Person",
"Organization": "foaf:Organization",
"Group": "foaf:Group",
"Network":
{
"@id": "openvocab.is#Network",
"@type": "rdfs:Class",
"rdfs:comment": {
"@language": "en",
"@value": "A Network is a ...."
},
"rdfs:subClassOf": {
"@id": "foaf:Group"
}
},
"name": "foaf:name",
"image": "foaf:image",
"Relationship": "as:Relationship",
"relationship": "as:relationship",
"subject": "as:subject",
"object": "as:object",
"context":
{
"@id": "openvocab.is#context",
"@type": "rdf:Property",
"rdfs:comment": {
"@language": "en",
"@value": "Identifies an Organization or Group (or subclasses of these) which is the context for this relationship...."
},
"rdfs:range": [ "foaf:Group", "foaf:Organization" ],
"rdfs:domain": "relationship"
},
"startDate":
{
"@id": "openvocab.is#startDate",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"endDate":
{
"@id": "openvocab.is#endDate",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
}
]
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment