本文整理汇总了TypeScript中n3.Writer.blank方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Writer.blank方法的具体用法?TypeScript Writer.blank怎么用?TypeScript Writer.blank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类n3.Writer
的用法示例。
在下文中一共展示了Writer.blank方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test_doc_blank_nodes_and_lists
function test_doc_blank_nodes_and_lists() {
const writer: N3.N3Writer = new N3.Writer({
prefixes: {
c: 'http://example.org/cartoons#',
foaf: 'http://xmlns.com/foaf/0.1/'
}
});
writer.addQuad(writer.blank(N3.DataFactory.namedNode('http://xmlns.com/foaf/0.1/givenName'), N3.DataFactory.literal('Tom', 'en')),
N3.DataFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
N3.DataFactory.namedNode('http://example.org/cartoons#Cat'));
writer.addQuad(N3.DataFactory.namedNode('http://example.org/cartoons#Jerry'),
N3.DataFactory.namedNode('http://xmlns.com/foaf/0.1/knows'),
writer.blank([{
predicate: N3.DataFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
object: N3.DataFactory.namedNode('http://example.org/cartoons#Cat')
}, {
predicate: N3.DataFactory.namedNode('http://xmlns.com/foaf/0.1/givenName'),
object: N3.DataFactory.literal('Tom', 'en'),
}]));
writer.addQuad(N3.DataFactory.namedNode('http://example.org/cartoons#Mammy'),
N3.DataFactory.namedNode('http://example.org/cartoons#hasPets'),
writer.list([
N3.DataFactory.namedNode('http://example.org/cartoons#Tom'),
N3.DataFactory.namedNode('http://example.org/cartoons#Jerry')
]));
writer.end((error, result) => { console.log(result); });
}