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

Fix getByURI

parent 4922d3f4
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,7 @@ export const getPaginatedResults = async ({
};
export const getAllResults = ({
resultClass, // TODO: handle other classes than manuscripts
// resultClass, // TODO: handle other classes than manuscripts
facetClass,
uriFilters,
spatialFilters,
......@@ -178,8 +178,10 @@ const getPaginatedData = ({
export const getByURI = ({
resultClass,
facetClass,
variant,
uriFilters,
spatialFilters,
textFilters,
//variant,
uri
}) => {
let q;
......@@ -188,16 +190,20 @@ export const getByURI = ({
q = placeQuery;
break;
}
if (variant === 'productionPlaces') {
const manuscriptsProduced =
`OPTIONAL {
${generateFilter(resultClass, facetClass, uriFilters, 'manuscript__id', null)}
?manuscript__id ^crm:P108_has_produced/crm:P7_took_place_at ?id .
?manuscript__id mmm-schema:data_provider_url ?manuscript__dataProviderUrl .
}`;
q = q.replace('<MANUSCRIPTS>', manuscriptsProduced);
const hasFilters = uriFilters !== null
|| spatialFilters !== null
|| textFilters !== null;
if (!hasFilters) {
q = q.replace('<FILTER>', '# no filters');
} else {
q = q.replace('<MANUSCRIPTS>', '');
q = q.replace('<FILTER>', generateFilter({
resultClass: resultClass,
facetClass: facetClass,
uriFilters: uriFilters,
spatialFilters: spatialFilters,
textFilters: textFilters,
filterTarget: 'manuscript__id',
facetID: null}));
}
q = q.replace('<ID>', `<${uri}>`);
// if (variant === 'productionPlaces') {
......
......@@ -40,17 +40,21 @@ export const allPlacesQuery = `
`;
export const placeQuery = `
SELECT ?id ?prefLabel ?sameAs ?dataProviderUrl ?parent__id ?parent__prefLabel ?manuscript__id ?manuscript__dataProviderUrl
WHERE {
BIND (<ID> AS ?id)
OPTIONAL { ?id skos:prefLabel ?prefLabel_ }
BIND(COALESCE(?prefLabel_, ?id) AS ?prefLabel)
OPTIONAL {
?id gvp:broaderPreferred ?parent__id .
?parent__id skos:prefLabel ?parent__prefLabel .
}
OPTIONAL { ?id mmm-schema:data_provider_url ?dataProviderUrl }
OPTIONAL { ?id owl:sameAs ?sameAs }
<MANUSCRIPTS>
}
SELECT ?id ?prefLabel ?sameAs ?dataProviderUrl ?parent__id ?parent__prefLabel ?manuscript__id ?manuscript__dataProviderUrl
WHERE {
BIND (<ID> AS ?id)
OPTIONAL { ?id skos:prefLabel ?prefLabel_ }
BIND(COALESCE(?prefLabel_, ?id) AS ?prefLabel)
OPTIONAL {
?id gvp:broaderPreferred ?parent__id .
?parent__id skos:prefLabel ?parent__prefLabel .
}
OPTIONAL { ?id mmm-schema:data_provider_url ?dataProviderUrl }
OPTIONAL { ?id owl:sameAs ?sameAs }
OPTIONAL {
<FILTER>
?manuscript__id ^crm:P108_has_produced/crm:P7_took_place_at ?id .
BIND(?manuscript__id AS ?manuscript__dataProviderUrl)
}
}
`;
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