Commit 01b6344b authored by Fabien Amarger's avatar Fabien Amarger
Browse files

feat(owl): Use ChipsUris component into OWL class view

parent 662f61b1a38b
Pipeline #94424 passed with stages
in 6 minutes and 25 seconds
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Container } from '@material-ui/core';
import { Container } from '@mui/material';
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
import { SparqlView } from '@logilab/libview';
import { querySparql, sparqlResultToArray } from '@logilab/sparqlutils';
import { Label, generateUrlFunction } from './utils';
import { ListUris } from './SharedComponents';
import { ChipsUris } from './SharedComponents';
interface OWLClassProps {
labels: Label[];
......@@ -48,7 +49,7 @@ const useOwlClassData = (uri: string, endpoint: string): OWLClassProps => {
SELECT DISTINCT ?instance ?label {
?instance a <${uri}> .
OPTIONAL{?instance rdfs:label ?label.}
} LIMIT 500`
} LIMIT 20000`
);
sparqlResultToArray(queryResults).forEach((elem) => {
const instanceUri = elem['instance'].value;
......@@ -89,10 +90,13 @@ const OWLClassComponent: React.FC<{ uri: string; endpoint: string; generateUrl:
<h1>{labels[0]?.value ?? uri}</h1>
<p style={{ fontFamily: "'Lucida Console', monospace" }}>{uri}</p>
{instances.length > 0 && (
<>
Instances:
<ListUris uris={instances} generateUrl={generateUrl} />
</>
<ChipsUris
relationName="Instances"
urisAndLabels={instances}
generateUrl={generateUrl}
icon={<ArrowForwardIosIcon />}
rowsPerPage={30}
/>
)}
</Container>
);
......
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