-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rdfInstanceViewer): Add literals
Switched out libraries from rdf-parse to n3, this allows better parsing and writing of rdf Added logic to add and remove literals. Store all quads in an N3 store Fixed logic to work with new store and fixed tests The entire graph is generated via the RDF
- Loading branch information
Showing
25 changed files
with
976 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import React, { FC, useEffect, useState } from 'react' | ||
import { TeliAutocomplete, TeliButton, TeliTextField } from "@telicent-oss/ds" | ||
import { DialogBox } from '../../lib/DialogBox/DialogBox' | ||
|
||
interface LiteralDialogProps { | ||
onClose: () => void | ||
onSubmit: (prefix: string, name: string) => void | ||
options: Array<string> | ||
title: string | ||
lastSelected: string | ||
} | ||
|
||
export const LiteralDialog: FC<LiteralDialogProps> = ({ options, onClose, title, onSubmit, lastSelected }) => { | ||
const [selectedEdgeType, setSelectedEdgeType] = useState<string>(lastSelected) | ||
const [attributeValue, setAttributeValue] = useState<string>("") | ||
|
||
useEffect(() => { | ||
const handleKeyPress = (event: KeyboardEvent) => { | ||
if (event.key === 'Enter') { | ||
onHandleSubmit() | ||
} | ||
} | ||
document.addEventListener('keypress', handleKeyPress) | ||
return () => { | ||
document.removeEventListener('keypress', handleKeyPress) | ||
} | ||
}, []) | ||
|
||
const onChangeName: React.ChangeEventHandler<HTMLInputElement> = (event) => { | ||
event.preventDefault() | ||
|
||
setAttributeValue(event.target.value) | ||
} | ||
|
||
const onChangeEdgeType = (event: React.SyntheticEvent<Element, Event>, value: string | null) => { | ||
event.preventDefault() | ||
if (!value) { | ||
console.warn("Invalid value", value) | ||
return | ||
} | ||
setSelectedEdgeType(value) | ||
} | ||
|
||
const onHandleSubmit = () => { | ||
if (!selectedEdgeType || !attributeValue) { | ||
console.warn("Literal must have valid inputs") | ||
return | ||
} | ||
onSubmit(selectedEdgeType, attributeValue) | ||
} | ||
|
||
return ( | ||
<DialogBox onClose={onClose} title={title}> | ||
<div className="dark:text-whiteSmoke flex flex-col gap-y-8 rounded"> | ||
<div className='flex gap-x-2'> | ||
<TeliAutocomplete options={options} width={150} label="DataTypeProperty" onChange={onChangeEdgeType} value={selectedEdgeType} /> | ||
<TeliTextField id="attribute-value" label="Value" onChange={onChangeName} value={attributeValue} required /> | ||
</div> | ||
<div className='flex justify-end w-full'> | ||
<TeliButton onClick={onHandleSubmit} variant="secondary" disabled={!attributeValue || !selectedEdgeType}>Submit</TeliButton> | ||
</div> | ||
</div> | ||
</DialogBox> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
export const DataTypePropertyResponseStub = { | ||
"head": { | ||
"vars": [ | ||
"data_type_property" | ||
] | ||
}, | ||
"results": { | ||
"bindings": [ | ||
{ | ||
"data_type_property": { | ||
"type": "uri", | ||
"value": "http://ies.data.gov.uk/ontology/ies4#idEmergencyContactTelNo" | ||
} | ||
}, | ||
{ | ||
"data_type_property": { | ||
"type": "uri", | ||
"value": "http://ies.data.gov.uk/ontology/ies4#endsIn" | ||
} | ||
}, | ||
{ | ||
"data_type_property": { | ||
"type": "uri", | ||
"value": "http://ies.data.gov.uk/ontology/ies4#issuerIdentificationNumber" | ||
} | ||
}, | ||
{ | ||
"data_type_property": { | ||
"type": "uri", | ||
"value": "http://ies.data.gov.uk/ontology/ies4#hmlConfidence" | ||
} | ||
}, | ||
] | ||
} | ||
} |
Oops, something went wrong.