Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nos Hs2023
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Språksamlingane
stadnamn
Nos Hs2023
Commits
5fdcd784
Commit
5fdcd784
authored
4 years ago
by
esikkala
Browse files
Options
Downloads
Patches
Plain Diff
Fix <
http://ldf.fi/MISSING_VALUE
> in selections
parent
ca7042a6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/client/reducers/sampo/perspective1Facets.js
+1
-3
1 addition, 3 deletions
src/client/reducers/sampo/perspective1Facets.js
src/server/sparql/FacetValues.js
+19
-22
19 additions, 22 deletions
src/server/sparql/FacetValues.js
src/server/sparql/Filters.js
+2
-4
2 additions, 4 deletions
src/server/sparql/Filters.js
with
22 additions
and
29 deletions
src/client/reducers/sampo/perspective1Facets.js
+
1
−
3
View file @
5fdcd784
...
...
@@ -77,8 +77,6 @@ export const INITIAL_STATE = {
type
:
'
hierarchical
'
,
selectAlsoSubconceptsButton
:
true
,
selectAlsoSubconcepts
:
true
,
// useConjuctionButton: true,
// useConjuction: true,
priority
:
5
},
productionTimespan
:
{
...
...
@@ -154,7 +152,7 @@ export const INITIAL_STATE = {
containerClass
:
'
ten
'
,
filterType
:
'
uriFilter
'
,
uriFilter
:
null
,
useConjuctionButton
:
true
,
useConjuctionButton
:
true
,
// experimental, does not work well with hierarchical facets
useConjuction
:
false
,
priority
:
3
},
...
...
This diff is collapsed.
Click to expand it.
src/server/sparql/FacetValues.js
+
19
−
22
View file @
5fdcd784
...
...
@@ -63,6 +63,7 @@ export const getFacet = async ({
let
unknownSelected
=
'
false
'
let
useConjuction
=
false
let
selectParents
=
facetConfig
.
type
===
'
hierarchical
'
let
currentSelectionsWithoutUnknown
=
[]
if
(
constraints
!==
null
)
{
filterBlock
=
generateConstraintsBlock
({
backendSearchConfig
,
...
...
@@ -74,7 +75,9 @@ export const getFacet = async ({
constrainSelf
})
const
currentSelections
=
getUriFilters
(
constraints
,
facetID
)
const
{
indexOfUnknown
}
=
handleUnknownValue
(
currentSelections
)
// If <http://ldf.fi/MISSING_VALUE> is selected, it needs special care
const
{
indexOfUnknown
,
modifiedValues
}
=
handleUnknownValue
(
currentSelections
)
currentSelectionsWithoutUnknown
=
modifiedValues
const
facet
=
constraints
.
find
(
c
=>
c
.
facetID
===
facetID
)
useConjuction
=
(
has
(
facet
,
'
useConjuction
'
)
&&
facet
.
useConjuction
)
if
(
indexOfUnknown
!==
-
1
)
{
...
...
@@ -87,19 +90,18 @@ export const getFacet = async ({
// if this facet has previous selections, include them in the query
if
(
hasPreviousSelections
(
constraints
,
facetID
))
{
selectedBlock
=
generateSelectedBlock
({
backendSearchConfig
,
facetID
,
constraints
currentSelectionsWithoutUnknown
})
/* if there are also filters from other facets, we need this
additional block for facet values that return 0 hits */
if
(
hasPreviousSelectionsFromOtherFacets
(
constraints
,
facetID
))
{
if
(
currentSelectionsWithoutUnknown
.
length
>
0
&&
hasPreviousSelectionsFromOtherFacets
(
constraints
,
facetID
))
{
selectedNoHitsBlock
=
generateSelectedNoHitsBlock
({
backendSearchConfig
,
facetClass
,
facetID
,
constraints
,
c
onstrainSelf
c
urrentSelectionsWithoutUnknown
})
}
}
...
...
@@ -111,7 +113,8 @@ export const getFacet = async ({
facetClass
,
facetID
,
constraints
,
parentPredicate
parentPredicate
,
currentSelectionsWithoutUnknown
})
parentsForFacetValues
=
`
OPTIONAL { ?id
${
facetConfig
.
parentProperty
}
?parent_ }
...
...
@@ -142,7 +145,7 @@ export const getFacet = async ({
q
=
q
.
replace
(
'
<START_PROPERTY>
'
,
facetConfig
.
startProperty
)
q
=
q
.
replace
(
'
<END_PROPERTY>
'
,
facetConfig
.
endProperty
)
}
// if (facetID === '
productionPlace
') {
// if (facetID === '
collection
') {
// console.log(endpoint.prefixes + q)
// }
const
response
=
await
runSelectQuery
({
...
...
@@ -171,14 +174,10 @@ export const getFacet = async ({
}
const
generateSelectedBlock
=
({
backendSearchConfig
,
facetID
,
constraints
currentSelectionsWithoutUnknown
})
=>
{
const
selectedFilter
=
generateSelectedFilter
({
backendSearchConfig
,
facetID
,
constraints
,
currentSelectionsWithoutUnknown
,
inverse
:
false
})
return
`
...
...
@@ -194,7 +193,7 @@ const generateSelectedNoHitsBlock = ({
facetClass
,
facetID
,
constraints
,
c
onstrainSelf
c
urrentSelectionsWithoutUnknown
})
=>
{
const
noHitsFilter
=
generateConstraintsBlock
({
backendSearchConfig
,
...
...
@@ -202,14 +201,13 @@ const generateSelectedNoHitsBlock = ({
constraints
:
constraints
,
filterTarget
:
'
instance
'
,
facetID
:
facetID
,
inverse
:
true
,
constrainSelf
inverse
:
true
})
return
`
UNION
# facet values that have been selected but return no results
{
VALUES ?id { <
${
getUriFilters
(
constraints
,
facetID
)
.
join
(
'
> <
'
)}
> }
VALUES ?id { <
${
currentSelectionsWithoutUnknown
.
join
(
'
> <
'
)}
> }
${
noHitsFilter
}
BIND(true AS ?selected_)
}
...
...
@@ -221,7 +219,8 @@ const generateParentBlock = ({
facetClass
,
facetID
,
constraints
,
parentPredicate
parentPredicate
,
currentSelectionsWithoutUnknown
})
=>
{
let
parentFilterStr
=
'
# no filters
'
let
ignoreSelectedValues
=
'
# no selected values
'
...
...
@@ -236,9 +235,7 @@ const generateParentBlock = ({
})
if
(
hasPreviousSelections
)
{
ignoreSelectedValues
=
generateSelectedFilter
({
backendSearchConfig
,
facetID
:
facetID
,
constraints
:
constraints
,
currentSelectionsWithoutUnknown
,
inverse
:
true
})
}
...
...
This diff is collapsed.
Click to expand it.
src/server/sparql/Filters.js
+
2
−
4
View file @
5fdcd784
...
...
@@ -408,12 +408,10 @@ const generateConjuctionForUriFilter = ({
}
export
const
generateSelectedFilter
=
({
backendSearchConfig
,
facetID
,
constraints
,
currentSelectionsWithoutUnknown
,
inverse
})
=>
{
return
(
`
FILTER(?id
${
inverse
?
'
NOT
'
:
''
}
IN ( <
${
getUriFilters
(
constraints
,
facetID
)
.
join
(
'
>, <
'
)}
> ))
FILTER(?id
${
inverse
?
'
NOT
'
:
''
}
IN ( <
${
currentSelectionsWithoutUnknown
.
join
(
'
>, <
'
)}
> ))
`
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment