Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121689156
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
Sun, Jul 13, 04:40
Size
1 KB
Mime Type
text/x-java
Expires
Tue, Jul 15, 04:40 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27374662
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";
import {CrossrefEditorDataServiceService} from '../crossref-editor-data-service.service';
import {Subscription} from 'rxjs';
@Component({
selector: 'app-rdf-editor-component',
templateUrl: './rdf-editor-component.component.html',
styleUrls: ['./rdf-editor-component.component.scss']
})
export class RdfEditorComponentComponent implements OnInit {
nodeSub: Subscription;
textGeneseWriter;
textGeneseTriples: string;
constructor( public dataService: CrossrefEditorDataServiceService) {
}
ngOnInit() {
this.textGeneseWriter = new N3.Writer({ prefixes: { data: 'http://rdfh.ch/projects/0068#' } });
this.nodeSub = this.dataService.clickedNodeEvent.subscribe(node => {
this.writeSthToTextGenese(node.iri);
//...
this.checkOutTextGenese();
});
}
writeSthToTextGenese(iri, prefix?: any) {
const {DataFactory} = N3;
const {namedNode, literal, defaultGraph, quad} = DataFactory;
const newIri = iri+'textgenese_0'
this.textGeneseWriter.addQuad(
namedNode(newIri),
namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
namedNode('tln:textGenese!!!')
);
}
checkOutTextGenese() {
this.textGeneseWriter.end((error, result) => {
console.log('typeof ', typeof result, ' result ', result);
this.textGeneseTriples = result;
});
}
}
Event Timeline
Log In to Comment