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

Add test config for speeches

parent 14ae7a26
No related branches found
No related tags found
No related merge requests found
......@@ -264,7 +264,7 @@ const Perspective1 = props => {
/>}
/>
<Route
path={`${rootUrl}/${perspective.id}/faceted-search/bar_chart_race`}
path={`${rootUrl}/${perspective.id}/faceted-search/bar_chart_race_ms_productions`}
render={() =>
<BarChartRace
fetchData={props.fetchResults}
......@@ -274,6 +274,17 @@ const Perspective1 = props => {
results={props.perspectiveState.results}
/>}
/>
<Route
path={`${rootUrl}/${perspective.id}/faceted-search/bar_chart_race_speeches`}
render={() =>
<BarChartRace
fetchData={props.fetchResults}
resultClass='speechesByYearAndParty'
facetClass='perspective1'
resultUpdateID={props.perspectiveState.resultUpdateID}
results={props.perspectiveState.results}
/>}
/>
<Route
path={`${rootUrl}/${perspective.id}/faceted-search/bar_chart_race2`}
render={() =>
......
......@@ -290,7 +290,8 @@ const resultClasses = new Set([
'eventLineChart',
'manuscriptInstancePageNetwork',
'manuscriptFacetResultsNetwork',
'perspective1KnowledgeGraphMetadata'
'perspective1KnowledgeGraphMetadata',
'speechesByYearAndParty'
])
const perspective1 = (state = INITIAL_STATE, action) => {
......
......@@ -4,6 +4,7 @@ import { perspective3Config } from './perspective_configs/Perspective3Config'
import { findsConfig } from './perspective_configs/FindsConfig'
import { actorsConfig } from './perspective_configs/EmloActorsConfig'
import { hellerauConfig } from './perspective_configs/HellerauConfig'
import { speechesConfig } from './perspective_configs/SemparlSpeechesConfig'
import {
productionPlacesQuery,
lastKnownLocationsQuery,
......@@ -53,6 +54,7 @@ import {
emloPeopleRelatedTo
} from './sparql_queries/SparqlQueriesEmloPlaces'
import { hellerauMigrationsQuery } from './sparql_queries/SparqlQueriesHellerau'
import { speechesByYearAndPartyQuery } from './sparql_queries/SparqlQueriesSpeeches'
import { federatedSearchDatasets } from './sparql_queries/SparqlQueriesFederatedSearch'
import { fullTextSearchProperties } from './sparql_queries/SparqlQueriesFullText'
import { sitemapInstancePageQuery } from '../SparqlQueriesGeneral'
......@@ -72,6 +74,7 @@ export const backendSearchConfig = {
finds: findsConfig,
emloActors: actorsConfig,
hellerau: hellerauConfig,
semparlSpeeches: speechesConfig,
manuscripts: {
perspectiveID: 'perspective1', // get rest of the config from 'perspective1'
instance: {
......@@ -200,6 +203,18 @@ export const backendSearchConfig = {
}
}
},
speechesByYearAndParty: {
perspectiveID: 'semparlSpeeches',
q: speechesByYearAndPartyQuery,
filterTarget: 'speech',
resultMapper: makeObjectList,
postprocess: {
func: toBarChartRaceFormat,
config: {
step: 1
}
}
},
eventLineChart: {
perspectiveID: 'perspective1',
q: eventsByDecadeQuery,
......
// import {
// speechPropertiesFacetResults,
// speechPropertiesInstancePage
// } from '../sparql_queries/SparqlQueriesSpeeches'
import { prefixes } from '../sparql_queries/SparqlQueriesPrefixes'
export const speechesConfig = {
endpoint: {
url: 'http://ldf.fi/semparl/sparql',
prefixes,
useAuth: true
},
facetClass: 'semparls:Speech',
langTag: 'fi',
includeInSitemap: true,
// defaultConstraint: `
// <SUBJECT> dct:source mmm-schema:Bibale .
// `,
// paginatedResults: {
// properties: speechPropertiesFacetResults
// },
// instance: {
// properties: speechPropertiesInstancePage,
// relatedInstances: '',
// defaultTab: 'table'
// },
facets: {
contentTextFacet: {
textQueryPredicate: '', // empty for querying the facetClass
textQueryProperty: 'semparls:content',
type: 'text'
},
prefLabel: {
labelPath: 'skos:prefLabel'
},
speaker: {
facetValueFilter: '',
labelPath: 'semparls:speaker/skos:prefLabel',
predicate: 'semparls:speaker',
type: 'list'
},
party: {
facetValueFilter: '',
labelPath: 'semparls:party/skos:prefLabel',
predicate: 'semparls:party',
type: 'list',
facetLabelFilter: 'FILTER(LANG(?prefLabel_) = "<LANG>")'
},
speechType: {
facetValueFilter: '',
labelPath: 'semparls:speechType/skos:prefLabel',
predicate: 'semparls:speechType',
type: 'list'
},
language: {
facetValueFilter: '',
labelPath: 'dct:language/skos:prefLabel',
predicate: 'dct:language',
type: 'list',
facetLabelFilter: 'FILTER(LANG(?prefLabel_) = "<LANG>")'
},
date: {
facetValueFilter: '',
labelPath: 'dct:date',
predicate: 'dct:date',
type: 'dateNoTimespan'
},
referencedPlace: {
facetValueFilter: '?id a crm:E53_Place', // use only semparl places
labelPath: 'semparl_linguistics:referenceToPlaceName/semparl_linguistics:link/skos:prefLabel',
predicate: 'semparl_linguistics:referenceToPlaceName/semparl_linguistics:link',
type: 'list',
facetLabelFilter: `
FILTER(LANG(?prefLabel_) = "<LANG>")`
},
documentType: {
facetValueFilter: '',
// labelPath: 'semparls:item/(semparls:relatedDocument|semparls:legislativeMotion|semparls:account|semparls:debateMotion|semparls:committeeReport|semparls:governmentProposal)/a',
labelPath: 'semparls:item/semparls:governmentProposal/a',
predicate: 'semparls:item/semparls:governmentProposal/a',
type: 'list'
}
}
}
......@@ -20,4 +20,5 @@ export const prefixes = `
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX h-schema: <http://ldf.fi/schema/hellerau/>
PREFIX gn: <http://www.geonames.org/ontology#>
PREFIX semparls: <http://ldf.fi/schema/semparl/>
`
const perspectiveID = 'speeches'
export const speechPropertiesInstancePage =
`
?id skos:prefLabel ?prefLabel__id .
BIND(?prefLabel__id as ?prefLabel__prefLabel)
BIND(?id as ?uri__id)
BIND(?id as ?uri__dataProviderUrl)
BIND(?id as ?uri__prefLabel)
{
?id semparls:speaker ?speaker__id .
?speaker__id skos:prefLabel ?speaker__prefLabel .
BIND(CONCAT("/people/page/", REPLACE(STR(?speaker__id), "^.*\\\\/(.+)", "$1")) AS ?speaker__dataProviderUrl)
}
UNION
{
?id semparls:party ?party__id .
?party__id skos:prefLabel ?party__prefLabel .
FILTER(LANG(?party__prefLabel) = "<LANG>")
BIND(CONCAT("/groups/page/", REPLACE(STR(?party__id), "^.*\\\\/(.+)", "$1")) AS ?party__dataProviderUrl)
}
UNION
{
?id semparls:speechType ?speechType__id .
# ?speechType__id skos:prefLabel ?speechType__prefLabel .
BIND(?speechType__id as ?speechType__prefLabel)
}
UNION
{
?id dct:language ?language_ .
BIND(REPLACE(STR(?language_), "http://id.loc.gov/vocabulary/iso639-2/", "") as ?language)
}
UNION
{
?id dct:date ?date_ .
BIND(CONCAT(STR(DAY(?date_)),
".",
STR(MONTH(?date_)),
".",
STR(YEAR(?date_))) as ?date)
}
UNION
{
?id semparl_linguistics:referenceToPlaceName/semparl_linguistics:link ?referencedPlace__id .
?referencedPlace__id skos:prefLabel ?referencedPlace__prefLabel .
FILTER(LANG(?referencedPlace__prefLabel) = "<LANG>")
}
UNION
{
?id semparls:content ?content .
}
UNION
{
?id semparls:item ?item__id .
?item__id skos:prefLabel ?item__prefLabel .
}
`
export const speechPropertiesFacetResults =
` ?id skos:prefLabel ?prefLabel__id .
BIND(?prefLabel__id as ?prefLabel__prefLabel)
BIND(CONCAT("/${perspectiveID}/page/", REPLACE(STR(?id), "^.*\\\\/(.+)", "$1")) AS ?prefLabel__dataProviderUrl)
BIND(?id as ?uri__id)
BIND(?id as ?uri__dataProviderUrl)
BIND(?id as ?uri__prefLabel)
{
?id semparls:speaker ?speaker__id .
?speaker__id skos:prefLabel ?speaker__prefLabel .
BIND(CONCAT("/people/page/", REPLACE(STR(?speaker__id), "^.*\\\\/(.+)", "$1")) AS ?speaker__dataProviderUrl)
}
UNION
{
?id semparls:party ?party__id .
?party__id skos:prefLabel ?party__prefLabel .
FILTER(LANG(?party__prefLabel) = "<LANG>")
BIND(CONCAT("/groups/page/", REPLACE(STR(?party__id), "^.*\\\\/(.+)", "$1")) AS ?party__dataProviderUrl)
}
UNION
{
?id semparls:speechType ?speechType__id .
?speechType__id skos:prefLabel ?speechType__prefLabel .
# BIND(REPLACE(STR(?speechType__id), "http://ldf.fi/semparl/", "") as ?speechType__prefLabel)
}
UNION
{
?id dct:language ?language_ .
BIND(REPLACE(STR(?language_), "http://id.loc.gov/vocabulary/iso639-2/", "") as ?language)
}
UNION
{
?id dct:date ?date_ .
BIND(CONCAT(STR(DAY(?date_)),
".",
STR(MONTH(?date_)),
".",
STR(YEAR(?date_))) as ?date)
}
UNION
{
?id semparl_linguistics:referenceToPlaceName/semparl_linguistics:link ?referencedPlace__id .
?referencedPlace__id skos:prefLabel ?referencedPlace__prefLabel .
FILTER(LANG(?referencedPlace__prefLabel) = "<LANG>")
}
UNION
{
?id semparls:item ?item__id .
?item__id skos:prefLabel ?item__prefLabel .
BIND(CONCAT("/items/page/", REPLACE(STR(?item__id), "^.*\\\\/(.+)", "$1")) AS ?item__dataProviderUrl) .
}
`
export const itemPropertiesInstancePage = `
BIND(?id as ?uri__id)
BIND(?id as ?uri__dataProviderUrl)
BIND(?id as ?uri__prefLabel)
{
?id skos:prefLabel ?prefLabel__id .
BIND(?prefLabel__id as ?prefLabel__prefLabel)
FILTER(LANG(?prefLabel__prefLabel)='<LANG>')
}
UNION
{
?id semparls:plenarySession ?plenarySession__id .
?plenarySession__id skos:prefLabel ?plenarySession__prefLabel .
}
UNION
{
?id semparls:governmentProposal ?governmentProposal__id .
?governmentProposal__id skos:prefLabel ?governmentProposal__prefLabel .
}
UNION
{
?id semparls:diary ?diary__id .
BIND(?diary__id as ?diary__prefLabel) .
BIND(?diary__id as ?diary__dataProviderUrl)
}
UNION
{
?speech__id semparls:item ?id .
?speech__id skos:prefLabel ?speech__prefLabel .
BIND(CONCAT("/speeches/page/", REPLACE(STR(?speech__id), "^.*\\\\/(.+)", "$1")) AS ?speech__dataProviderUrl) .
}
`
export const speechesByYearAndPartyQuery = `
SELECT ?id ?dataItem__id ?dataItem__prefLabel (count(?speech) as ?dataItem__value) WHERE {
?speech semparls:party ?dataItem__id ;
semparls:speechType ?speechType ;
dct:date ?date .
?dataItem__id skos:prefLabel ?dataItem__prefLabel .
BIND(YEAR(?date) as ?id)
FILTER(?speechType NOT IN (<http://ldf.fi/semparl/speechtypes/PuhemiesPuheenvuoro>))
FILTER(LANG(?dataItem__prefLabel) = "<LANG>")
}
GROUP BY ?id ?dataItem__id ?dataItem__prefLabel
ORDER BY ?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