Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Culture
culture-views
Commits
c5e4526aa9c6
Commit
bf16ff83
authored
Sep 23, 2020
by
Fabien Amarger
Browse files
feat: [priorityFor] Define non suitable data for a dedicated view
Returns -1 if the view is not suitable.
parent
7a0eb8a1e4e6
Pipeline
#15061
failed with stages
in 3 minutes and 42 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bienCulturelClass/bienCulturelClass.tsx
View file @
c5e4526a
...
...
@@ -14,6 +14,7 @@ L.Icon.Default.imagePath = `${process.env.DOMAIN}/images/`;
const
RDF
=
$rdf
.
Namespace
(
'
http://www.w3.org/1999/02/22-rdf-syntax-ns#
'
);
const
RDFS
=
$rdf
.
Namespace
(
'
http://www.w3.org/2000/01/rdf-schema#
'
);
const
OWL
=
$rdf
.
Namespace
(
'
http://www.w3.org/2002/07/owl#
'
);
const
CULT
=
$rdf
.
Namespace
(
'
http://graphe-culture.fr/
'
);
const
DESCRIPTOR_BIENCULTURELCLASS
:
definition
.
ViewDescriptor
=
{
...
...
@@ -142,6 +143,14 @@ class BienCulturelClassRendering implements implementation.ViewImplementation {
const
targetSym
=
$rdf
.
sym
(
target
.
uri
);
if
(
context
.
any
(
null
,
RDF
(
'
type
'
),
targetSym
)
===
null
&&
context
.
any
(
targetSym
,
RDF
(
'
type
'
),
OWL
(
'
Class
'
))
===
null
&&
context
.
any
(
targetSym
,
RDF
(
'
type
'
),
RDFS
(
'
Class
'
))
===
null
)
{
return
-
1
;
// this view is not suitable if it is not a class
}
if
(
target
.
uri
===
CULT
(
'
BienCulturel
'
).
value
)
{
// if it is BienCulturel
score
+=
30
;
...
...
src/localisation/localisation.tsx
View file @
c5e4526a
...
...
@@ -14,6 +14,7 @@ import './localisation.css';
const
RDF
=
$rdf
.
Namespace
(
'
http://www.w3.org/1999/02/22-rdf-syntax-ns#
'
);
const
RDFS
=
$rdf
.
Namespace
(
'
http://www.w3.org/2000/01/rdf-schema#
'
);
const
OWL
=
$rdf
.
Namespace
(
'
http://www.w3.org/2002/07/owl#
'
);
const
CULT
=
$rdf
.
Namespace
(
'
http://graphe-culture.fr/
'
);
const
DESCRIPTOR_LOCALISATION
:
definition
.
ViewDescriptor
=
{
...
...
@@ -160,6 +161,14 @@ class LocalisationRendering implements implementation.ViewImplementation {
const
targetSym
=
$rdf
.
sym
(
target
.
uri
);
if
(
context
.
any
(
null
,
RDF
(
'
type
'
),
targetSym
)
!==
null
||
context
.
any
(
targetSym
,
RDF
(
'
type
'
),
OWL
(
'
Class
'
))
!==
null
||
context
.
any
(
targetSym
,
RDF
(
'
type
'
),
RDFS
(
'
Class
'
))
!==
null
)
{
return
-
1
;
// this view is not suitable if it is a class
}
// has at least one type
const
firstType
=
context
.
any
(
targetSym
,
RDF
(
'
type
'
));
if
(
firstType
!==
null
)
{
...
...
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