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

Implementing view specific to DBPedia

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