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
a824362a
Commit
a824362a
authored
6 years ago
by
esikkala
Browse files
Options
Downloads
Patches
Plain Diff
Add custom parents for places that are not linked to TGN
parent
37ec4c71
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/components/HierarchicalFacet.js
+7
-4
7 additions, 4 deletions
src/client/components/HierarchicalFacet.js
src/server/sparql/Datasets.js
+1
-3
1 addition, 3 deletions
src/server/sparql/Datasets.js
src/server/sparql/Mappers.js
+58
-2
58 additions, 2 deletions
src/server/sparql/Mappers.js
with
66 additions
and
9 deletions
src/client/components/HierarchicalFacet.js
+
7
−
4
View file @
a824362a
...
...
@@ -118,7 +118,8 @@ class HierarchicalFacet extends Component {
generateLabelClass
=
(
classes
,
node
)
=>
{
let
labelClass
=
classes
.
label
;
if
(
this
.
props
.
property
===
'
author
'
||
this
.
props
.
property
===
'
productionPlace
'
||
this
.
props
.
property
===
'
source
'
)
{
if
(
this
.
props
.
property
===
'
author
'
||
this
.
props
.
property
===
'
source
'
)
{
if
(
node
.
source
===
'
http://ldf.fi/mmm/schema/SDBM
'
||
node
.
id
===
'
http://ldf.fi/mmm/schema/SDBM
'
)
{
labelClass
=
classes
.
sdbmLabel
;
}
...
...
@@ -138,9 +139,11 @@ class HierarchicalFacet extends Component {
// console.log(this.props.data)
// Case insensitive search of `node.title`
const
customSearchMethod
=
({
node
,
searchQuery
})
=>
searchQuery
.
length
>
2
&&
node
.
prefLabel
.
toLowerCase
().
indexOf
(
searchQuery
.
toLowerCase
())
>
-
1
;
const
customSearchMethod
=
({
node
,
searchQuery
})
=>
{
let
prefLabel
=
Array
.
isArray
(
node
.
prefLabel
)
?
node
.
prefLabel
[
0
]
:
node
.
prefLabel
;
return
searchQuery
.
length
>
2
&&
prefLabel
.
toLowerCase
().
indexOf
(
searchQuery
.
toLowerCase
())
>
-
1
;
};
const
selectPrevMatch
=
()
=>
this
.
setState
({
...
...
This diff is collapsed.
Click to expand it.
src/server/sparql/Datasets.js
+
1
−
3
View file @
a824362a
...
...
@@ -231,8 +231,6 @@ module.exports = {
PREFIX frbroo: <http://erlangen-crm.org/efrbroo/>
PREFIX mmm-schema: <http://ldf.fi/mmm/schema/>
PREFIX gvp: <http://vocab.getty.edu/ontology#>
SELECT DISTINCT ?id ?prefLabel ?selected ?source ?parent ?instanceCount {
{
{
...
...
@@ -246,7 +244,7 @@ module.exports = {
OPTIONAL { ?id dct:source ?source }
OPTIONAL {
?id gvp:broaderPreferred ?parent_ .
FILTER(?parent_ != <http://ldf.fi/mmm/places/tgn_7029392>)
#
FILTER(?parent_ != <http://ldf.fi/mmm/places/tgn_7029392>)
}
BIND(COALESCE(?parent_, '0') as ?parent)
}
...
...
This diff is collapsed.
Click to expand it.
src/server/sparql/Mappers.js
+
58
−
2
View file @
a824362a
...
...
@@ -37,11 +37,36 @@ export const mapFacet = sparqlBindings => {
export
const
mapHierarchicalFacet
=
sparqlBindings
=>
{
const
results
=
makeObjectList
(
sparqlBindings
);
//console.log(results)
results
.
push
({
id
:
'
http://ldf.fi/mmm/places/sdbm_not_linked
'
,
prefLabel
:
'
SDBM places not linked to TGN
'
,
selected
:
'
false
'
,
source
:
'
http://ldf.fi/mmm/schema/SDBM
'
,
instanceCount
:
'
0
'
,
parent
:
'
0
'
});
results
.
push
({
id
:
'
http://ldf.fi/mmm/places/bodley_not_linked
'
,
prefLabel
:
'
Bodley places not linked to TGN
'
,
selected
:
'
false
'
,
source
:
'
http://ldf.fi/mmm/schema/Bodley
'
,
instanceCount
:
'
0
'
,
parent
:
'
0
'
});
results
.
push
({
id
:
'
http://ldf.fi/mmm/places/bibale_not_linked
'
,
prefLabel
:
'
Bibale places not linked to TGN
'
,
selected
:
'
false
'
,
source
:
'
http://ldf.fi/mmm/schema/Bibale
'
,
instanceCount
:
'
0
'
,
parent
:
'
0
'
});
let
treeData
=
getTreeFromFlatData
({
flatData
:
results
,
getKey
:
node
=>
node
.
id
,
// resolve a node's key
getParentKey
:
node
=>
node
.
p
arent
,
// resolve node's parent's key
rootKey
:
0
,
// The value of the parent key when there is no parent (i.e., at root level)
getParentKey
:
getP
arent
Key
,
// resolve node's parent's key
rootKey
:
'
0
'
,
// The value of the parent key when there is no parent (i.e., at root level)
});
treeData
=
recursiveSort
(
treeData
);
treeData
.
forEach
(
node
=>
sumUp
(
node
));
...
...
@@ -51,6 +76,37 @@ export const mapHierarchicalFacet = sparqlBindings => {
};
};
const
rootLevel
=
new
Set
([
'
http://ldf.fi/mmm/places/tgn_7029392
'
,
'
http://ldf.fi/mmm/places/sdbm_not_linked
'
,
'
http://ldf.fi/mmm/places/bodley_not_linked
'
,
'
http://ldf.fi/mmm/places/bibale_not_linked
'
]);
const
getParentKey
=
node
=>
{
let
parent
=
''
;
if
(
node
.
parent
===
'
0
'
&&
!
rootLevel
.
has
(
node
.
id
))
{
if
(
Array
.
isArray
(
node
.
source
))
{
if
(
node
.
source
.
indexOf
(
'
http://ldf.fi/mmm/schema/SDBM
'
)
!=
-
1
)
{
parent
=
'
http://ldf.fi/mmm/places/sdbm_not_linked
'
;
}
else
if
(
node
.
source
.
indexOf
(
'
http://ldf.fi/mmm/schema/Bodley
'
)
!=
-
1
)
{
parent
=
'
http://ldf.fi/mmm/places/bodley_not_linked
'
;
}
else
if
(
node
.
source
.
indexOf
(
'
http://ldf.fi/mmm/schema/Bibale
'
)
!=
-
1
)
{
parent
=
'
http://ldf.fi/mmm/places/bibale_not_linked
'
;
}
}
else
if
(
node
.
source
===
'
http://ldf.fi/mmm/schema/SDBM
'
)
{
parent
=
'
http://ldf.fi/mmm/places/sdbm_not_linked
'
;
}
else
if
(
node
.
source
===
'
http://ldf.fi/mmm/schema/Bodley
'
)
{
parent
=
'
http://ldf.fi/mmm/places/bodley_not_linked
'
;
}
else
if
(
node
.
source
===
'
http://ldf.fi/mmm/schema/Bibale
'
)
{
parent
=
'
http://ldf.fi/mmm/places/bibale_not_linked
'
;
}
}
else
{
parent
=
node
.
parent
;
}
return
parent
;
};
const
comparator
=
(
a
,
b
)
=>
{
if
(
Array
.
isArray
(
a
.
prefLabel
))
{
a
.
prefLabel
=
a
.
prefLabel
[
0
];
...
...
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