Skip to content
Snippets Groups Projects
Commit 47b19e61 authored by esikkala's avatar esikkala
Browse files

Manuscripts: add last known location tab

parent 85800744
No related branches found
No related tags found
No related merge requests found
......@@ -387,6 +387,10 @@ class LeafletMap extends React.Component {
popUpTemplate += `<p>Manuscripts produced here:</p>`;
popUpTemplate += this.createInstanceListing(result.related);
}
if (this.props.resultClass === 'lastKnownLocations') {
popUpTemplate += `<p>Last known location of:</p>`;
popUpTemplate += this.createInstanceListing(result.related);
}
if (this.props.resultClass === 'placesActors') {
popUpTemplate += `<p>Actors:</p>`;
popUpTemplate += this.createInstanceListing(result.related);
......
......@@ -5,7 +5,7 @@ import PerspectiveTabs from '../../main_layout/PerspectiveTabs';
import ResultTable from '../../facet_results/ResultTable';
import LeafletMap from '../../facet_results/LeafletMap';
import Deck from '../../facet_results/Deck';
import TemporalMap from '../../facet_results/TemporalMap';
// import TemporalMap from '../../facet_results/TemporalMap';
import Pie from '../../facet_results/Pie';
import Network from '../../facet_results/Network';
import Export from '../../facet_results/Export';
......@@ -57,6 +57,26 @@ let Manuscripts = props => {
updateFacetOption={props.updateFacetOption}
/>}
/>
<Route
path={'/manuscripts/faceted-search/last_known_locations'}
render={() =>
<LeafletMap
results={props.places.results}
pageType='facetResults'
facetUpdateID={props.facetData.facetUpdateID}
facet={props.facetData.facets.lastKnownLocation}
facetID='lastKnownLocation'
resultClass='lastKnownLocations'
facetClass='manuscripts'
mapMode='cluster'
instance={props.places.instance}
fetchResults={props.fetchResults}
fetchByURI={props.fetchByURI}
fetching={props.places.fetching}
showInstanceCountInClusters={true}
updateFacetOption={props.updateFacetOption}
/>}
/>
<Route
path={'/manuscripts/faceted-search/statistics'}
render={() =>
......
import React from 'react';
import CalendarViewDayIcon from '@material-ui/icons/CalendarViewDay';
import AddLocationIcon from '@material-ui/icons/AddLocation';
import LocationOnIcon from '@material-ui/icons/LocationOn';
import RedoIcon from '@material-ui/icons/Redo';
import CloudDownloadIcon from '@material-ui/icons/CloudDownload';
......@@ -21,13 +22,18 @@ export const perspectiveConfig = [
icon: <AddLocationIcon />,
},
{
id: 'migrations',
id: 'last_known_locations',
value: 2,
icon: <LocationOnIcon />,
},
{
id: 'migrations',
value: 3,
icon: <RedoIcon />,
},
{
id: 'export',
value: 3,
value: 4,
icon: <CloudDownloadIcon />,
}
],
......
......@@ -138,6 +138,7 @@ const resultClasses = new Set([
'placesAll',
'placesActors',
'placesMsProduced',
'lastKnownLocations',
'placesMsMigrations',
'placesEvents'
]);
......
......@@ -28,6 +28,7 @@ export default {
table: 'table',
map: 'map',
production_places: 'production places',
last_known_locations: 'last known locations',
migrations: 'migrations',
export: 'export',
'by-period': 'by period'
......
......@@ -12,6 +12,7 @@ import {
expressionProperties,
collectionProperties,
productionPlacesQuery,
lastKnownLocationsQuery,
migrationsQuery,
networkQuery,
allManuscriptsQuery
......@@ -28,6 +29,7 @@ import {
placePropertiesFacetResults,
placePropertiesInfoWindow,
manuscriptsProducedAt,
lastKnownLocationsAt,
actorsAt,
allPlacesQuery,
} from './SparqlQueriesPlaces';
......@@ -86,6 +88,11 @@ export const getAllResults = ({
filterTarget = 'manuscripts';
mapper = mapPlaces;
break;
case 'lastKnownLocations':
q = lastKnownLocationsQuery;
filterTarget = 'manuscripts';
mapper = mapPlaces;
break;
case 'placesActors':
q = placesActorsQuery;
filterTarget = 'actor__id';
......@@ -292,6 +299,11 @@ export const getByURI = ({
q = q.replace('<PROPERTIES>', placePropertiesInfoWindow);
q = q.replace('<RELATED_INSTANCES>', manuscriptsProducedAt);
break;
case 'lastKnownLocations':
q = instanceQuery;
q = q.replace('<PROPERTIES>', placePropertiesInfoWindow);
q = q.replace('<RELATED_INSTANCES>', lastKnownLocationsAt);
break;
case 'placesEvents':
q = instanceQuery;
q = q.replace('<PROPERTIES>', placePropertiesInfoWindow);
......
......@@ -445,6 +445,18 @@ export const productionPlacesQuery = `
GROUP BY ?id ?lat ?long
`;
export const lastKnownLocationsQuery = `
SELECT ?id ?lat ?long
(COUNT(DISTINCT ?manuscripts) as ?instanceCount)
WHERE {
<FILTER>
?manuscripts mmm-schema:last_known_location ?id .
?id wgs84:lat ?lat ;
wgs84:long ?long .
}
GROUP BY ?id ?lat ?long
`;
//# https://github.com/uber/deck.gl/blob/master/docs/layers/arc-layer.md
export const migrationsQuery = `
SELECT DISTINCT ?id ?manuscript__id ?manuscript__url ?from__id ?from__name
......
......@@ -138,6 +138,15 @@ export const manuscriptsProducedAt = `
}
`;
export const lastKnownLocationsAt = `
OPTIONAL {
<FILTER>
?related__id mmm-schema:last_known_location ?id .
?related__id skos:prefLabel ?related__prefLabel .
BIND(CONCAT("/manuscripts/page/", REPLACE(STR(?related__id), "^.*\\\\/(.+)", "$1")) AS ?related__dataProviderUrl)
}
`;
export const actorsAt = `
OPTIONAL {
{ ?related__id crm:P98i_was_born/crm:P7_took_place_at ?id }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment