Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
SemWeb
Generic Views
Commits
1da08e8bf74e
Commit
01b6344b
authored
Nov 17, 2021
by
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
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/owlclass.tsx
View file @
1da08e8b
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
{
List
Uris
}
from
'
./SharedComponents
'
;
import
{
Chips
Uris
}
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
5
00`
} LIMIT
200
00`
);
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
>
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment