Commit c04d2a39 authored by Laurent Wouters's avatar Laurent Wouters
Browse files

Implementing view specific to DBPedia

parent 092b3645b48b
......@@ -27,7 +27,7 @@ import {
/// <reference path="../../common/rdflib-interface.d.ts"/>
import { RdfStore, Triple, Term, NamedNode, BlankNode, Literal } from "rdflib";
import * as React from "react";
import { hasTraitDbPediaPerson } from "../../common/rdf";
import { hasTraitDbPediaPerson, $rdf } from "../../common/rdf";
export class NTripleRendering implements ViewImplementation {
constructor() {
......@@ -143,6 +143,12 @@ export class DBPediaPersonRendering implements ViewImplementation {
root: string,
target: string
): React.ReactNode {
let name = store.any(
$rdf.sym(root),
$rdf.sym("http://xmlns.com/foaf/0.1/name"),
undefined,
undefined
).value;
return (
<div
style={{
......@@ -164,20 +170,9 @@ export class DBPediaPersonRendering implements ViewImplementation {
{this.descriptor.name}
</div>
</div>
<table className="table-striped table-condensed">
<thead>
<tr>
<td>Subject</td>
<td>Property</td>
<td>Object</td>
</tr>
</thead>
<tbody>
{store.statements.map((triple: Triple, index: number) => {
return renderRdfTriple(triple, index);
})}
</tbody>
</table>
<div>
<span>Name: {name}</span>
</div>
</div>
);
}
......
Markdown is supported
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