Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var rdf = require('rdf-ext')
var simple = require('../')
var blogContext = {
name: 'http://schema.org/name',
post: {
'@id': 'http://schema.org/post',
'@container': '@set'
},
headline: 'http://schema.org/headline',
content: 'http://schema.org/content'
}
var blogIri = 'http://example.org/blog'
var blogPostNode = rdf.createBlankNode()
var blogGraph = rdf.createGraph([
rdf.createTriple(
rdf.createNamedNode(blogIri),
rdf.createNamedNode('http://schema.org/name'),
rdf.createLiteral('simple blog')),
rdf.createTriple(
rdf.createNamedNode(blogIri),
rdf.createNamedNode('http://schema.org/post'),
blogPostNode),
rdf.createTriple(
blogPostNode,
rdf.createNamedNode('http://schema.org/headline'),
rdf.createLiteral('first blog post'))
])
static buildIri (iri) {
if (typeof iri === 'string') {
return rdf.createNamedNode(iri)
} else {
return iri || rdf.createBlankNode()
}
}
}