Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F59114261
rdf-editor-component.component.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Apr 19, 21:40
Size
1 KB
Mime Type
text/x-java
Expires
Sun, Apr 21, 21:40 (2 d)
Engine
blob
Format
Raw Data
Handle
17087226
Attached To
rNIETZSCHEBETAAPP Nietzsche-Beta-App
rdf-editor-component.component.ts
View Options
import { Component, OnInit } from '@angular/core';
import * as N3 from "node_modules/n3/src";
@Component({
selector: 'app-rdf-editor-component',
templateUrl: './rdf-editor-component.component.html',
styleUrls: ['./rdf-editor-component.component.scss']
})
export class RdfEditorComponentComponent implements OnInit {
constructor() {
}
ngOnInit() {
const {DataFactory} = N3;
const {namedNode, literal, defaultGraph, quad} = DataFactory;
const myQuad = quad(
namedNode('https://ruben.verborgh.org/profile/#me'),
namedNode('http://xmlns.com/foaf/0.1/givenName'),
literal('Ruben', 'en'),
defaultGraph(),
);
console.log(myQuad.termType); // Quad
console.log(myQuad.value); // ''
console.log(myQuad.subject.value); // https://ruben.verborgh.org/profile/#me
console.log(myQuad.object.value); // Ruben
console.log(myQuad.object.datatype.value); // http://www.w3.org/1999/02/22-rdf-syntax-ns#langString
console.log(myQuad.object.language); // en
this.writeSth();
}
interLinkTextUnits(textA: string, textB: string): string {
let ttlString: string;
return ttlString;
}
writeSth() {
const {DataFactory} = N3;
const {namedNode, literal, defaultGraph, quad} = DataFactory;
const writer = new N3.Writer({ prefixes: { c: 'http://example.org/cartoons#' } });
writer.addQuad(
namedNode('http://example.org/cartoons#Tom'),
namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
namedNode('http://example.org/cartoons#Cat')
);
writer.addQuad(quad(
namedNode('http://example.org/cartoons#Tom'),
namedNode('http://example.org/cartoons#name'),
literal('Tom')
));
writer.end((error, result) => console.log('typeof ', typeof result, ' result ', result));
}
}
Event Timeline
Log In to Comment