Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Coscine
frontend
libraries
form-generator
Commits
20dbf027
Commit
20dbf027
authored
Feb 04, 2022
by
Benedikt Heinrichs
Committed by
Kimia Beheshti
Feb 04, 2022
Browse files
Fix: Use TargetClass if exists (coscine/issues#1826)
parent
fc1b19e2
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
src/FormGenerator.vue
View file @
20dbf027
...
...
@@ -110,9 +110,6 @@ export default LinkedDataHandler.extend({
this
.
handleApplicationProfiles
();
},
watch
:
{
SHACLDefinition
()
{
this
.
handleApplicationProfiles
();
},
formData
()
{
this
.
input
();
this
.
createValidations
();
...
...
@@ -123,6 +120,12 @@ export default LinkedDataHandler.extend({
this
.
applicationProfileId
);
},
languageLocale
()
{
i18n
.
locale
=
this
.
languageLocale
;
},
SHACLDefinition
()
{
this
.
handleApplicationProfiles
();
},
},
methods
:
{
createValidations
()
{
...
...
src/base/LinkedDataHandler.ts
View file @
20dbf027
...
...
@@ -26,7 +26,19 @@ export default Vue.extend({
>
{
// RDF/JSON => JSON-LD since the loadDataset function doesn't support RDF/JSON
const
combinedDataObject
=
[];
const
dataObject
=
this
.
processDataObject
(
formData
,
applicationProfileId
);
let
targetClass
:
string
|
undefined
=
undefined
;
const
targetClassDefs
=
quads
.
filter
(
(
quad
)
=>
quad
.
subject
.
value
===
applicationProfileId
&&
quad
.
predicate
.
value
===
'
http://www.w3.org/ns/shacl#targetClass
'
);
if
(
targetClassDefs
.
length
>
0
)
{
targetClass
=
targetClassDefs
[
0
].
object
.
value
;
}
const
dataObject
=
this
.
processDataObject
(
formData
,
targetClass
?
targetClass
:
applicationProfileId
);
combinedDataObject
.
push
(
dataObject
);
// rdfs:subClassOf definitions have to be included for the validation to work with inheritance
...
...
@@ -191,9 +203,9 @@ export default Vue.extend({
getPropertySubjects
(
properties
:
Array
<
Quad
>
)
{
return
[...
new
Set
(
properties
.
map
((
property
)
=>
property
.
subject
.
value
))];
},
processDataObject
(
formData
:
any
,
applicationProfileId
:
string
)
{
processDataObject
(
formData
:
any
,
typeIdentifier
:
string
)
{
const
dataObject
=
{}
as
any
;
dataObject
[
'
@type
'
]
=
applicationProfileId
;
dataObject
[
'
@type
'
]
=
typeIdentifier
;
for
(
const
nodeName
of
Object
.
keys
(
formData
))
{
if
(
formData
[
nodeName
].
some
((
element
:
any
)
=>
element
[
'
value
'
]
!==
''
)
...
...
src/components/WrapperInput.vue
View file @
20dbf027
...
...
@@ -156,13 +156,6 @@ export default Vue.extend({
i18n
.
locale
=
this
.
languageLocale
;
this
.
nodeName
=
FieldReader
.
getNodeName
(
this
.
formFieldInformation
);
this
.
label
=
FieldReader
.
getLocalizedField
(
this
.
formFieldInformation
,
this
.
languageLocale
);
if
(
this
.
label
===
''
)
{
this
.
label
=
this
.
nodeName
;
}
if
(
this
.
checkField
(
...
...
@@ -277,6 +270,16 @@ export default Vue.extend({
return
uuid_v4
();
});
},
label
():
string
{
let
label
=
FieldReader
.
getLocalizedField
(
this
.
formFieldInformation
,
this
.
languageLocale
);
if
(
label
===
''
)
{
label
=
this
.
nodeName
;
}
return
label
;
},
state
():
boolean
|
null
{
if
(
this
.
v
.
formData
[
this
.
nodeName
]
&&
...
...
@@ -291,7 +294,6 @@ export default Vue.extend({
return
{
type
:
'
literal
'
,
datatype
:
''
,
label
:
'
Label:
'
,
nodeName
:
''
,
minCount
:
1
,
maxCount
:
1
,
...
...
yarn.lock-workspace
View file @
20dbf027
This diff is collapsed.
Click to expand it.
CoscineBot
⚙
@CoscineBot
mentioned in commit
7f1d93cf
·
Feb 14, 2022
mentioned in commit
7f1d93cf
mentioned in commit 7f1d93cffcbc8172e22af264b5ff239d99499e64
Toggle commit list
Write
Preview
Supports
Markdown
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