Skip to content

Commit 828a64e

Browse files
author
AQUINO SANCHEZ Jorge
committed
Add Lieux
1 parent 759b33b commit 828a64e

File tree

3 files changed

+29
-33
lines changed

3 files changed

+29
-33
lines changed

scripts/frame.js

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,22 @@ function cleanPreferredAgentsNames(graph) {
219219
return graph.filter((obj) => !toRemoveIds.has(obj.id));
220220
}
221221

222+
// filter
223+
function filterShow(jsonData) {
224+
const data = []
225+
let nIndex = 0
226+
for (const obj of jsonData) {
227+
const nKeys = Object.keys(obj).length;
228+
if (nKeys > 7) {
229+
if (nIndex < 11) {
230+
data.push(obj);
231+
nIndex++;
232+
}
233+
}
234+
}
235+
return data;
236+
};
237+
222238
let framed = async function (dataJsonLd, framingSpecPath, outputFile) {
223239
let framingSpec = fs.readFileSync(framingSpecPath, {
224240
ncoding: "utf8",
@@ -240,11 +256,13 @@ let framed = async function (dataJsonLd, framingSpecPath, outputFile) {
240256

241257
(async () => {
242258
// Lecture de fichiers
243-
259+
244260
console.log("Reading " + "./_json/garance.json" + " ...");
245-
let dataJsonLd = JSON.parse(fs.readFileSync("./_json/garance.json", { encoding: "utf8", flag: "r" }));
261+
let dataJsonLd = JSON.parse(
262+
fs.readFileSync("./_json/garance.json", { encoding: "utf8", flag: "r" })
263+
);
246264
console.log("Done");
247-
265+
248266
console.log("Now framing agents...");
249267
// create deep copy of dataJsonLd
250268
agentFramingData = JSON.parse(JSON.stringify(dataJsonLd));
@@ -295,13 +313,13 @@ let framed = async function (dataJsonLd, framingSpecPath, outputFile) {
295313
await framed(dataJsonLd,"src/_data/framings/index-framing.json","src/_data/index.json");
296314

297315
console.log("Now framing Place...");
298-
await framed(dataJsonLd,"src/_data/framings/place-framing.json","src/_data/place.json");
316+
await framed(dataJsonLd,"src/_data/framings/place-framing.json","src/_data/places.json");
299317
console.log("Post-processing: place ...");
300-
let placeData = JSON.parse(fs.readFileSync("src/_data/place.json", { encoding: "utf8", flag: "r" }));
301-
//
318+
let placesData = JSON.parse(fs.readFileSync("src/_data/places.json", { encoding: "utf8", flag: "r" })); //
302319
// remove element with place to agent
303-
placesData.graph = removeElementnotPlace(placesData.graph);
320+
placesData.graph = removeElementnotPlace(placesData.graph);
321+
// getting 10 Element only for show deploy
322+
placesData.graph = filterShow(placesData.graph);
304323
// write in place file
305324
fs.writeFileSync("src/_data/places.json",JSON.stringify(placesData, null, 2),{ encoding: "utf8" });
306-
307325
})();

src/_data/framings/place-framing.json

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@
2424
"@explicit": true,
2525
"type": "rico:Place",
2626
"rdfs:label": { "@omitDefault": true },
27-
"skos:prefLabel": { "@omitDefault": true },
28-
"skos:altLabel": { "@omitDefault": true },
2927
"rico:beginningDate": { "@omitDefault": true },
3028
"rico:endDate": { "@omitDefault": true },
3129
"rico:type": { "@omitDefault": true },
3230
"rico:history": { "@omitDefault": true },
3331
"rico:hasOrHadPlaceType": {
3432
"@omitDefault": true,
35-
"@explicit": true
33+
"@explicit": true,
34+
"rdfs:label": { "@omitDefault": true }
3635
},
3736
"rico:hasOrHadLocation": {
3837
"@omitDefault": true,
@@ -43,7 +42,6 @@
4342
"owl:sameAs": {
4443
"@omitDefault": true,
4544
"@explicit": true,
46-
"@id": {},
4745
"rdfs:label": { "@omitDefault": true }
4846
},
4947
"rdfs:seeAlso": {
@@ -54,34 +52,21 @@
5452
"insee-geo:codeCommune": { "@omitDefault": true, "@explicit": true },
5553
"insee-geo:chefLieu": { "@omitDefault": true, "@explicit": true },
5654
"insee-geo:codeRegion": { "@omitDefault": true, "@explicit": true },
57-
"rico:descriptiveNote": {
58-
"@omitDefault": true,
59-
"@explicit": true
60-
},
61-
"skos:changeNote": {
62-
"@omitDefault": true,
63-
"@explicit": true,
64-
"dc:date": { "@omitDefault": true },
65-
"rdf:value": { "@omitDefault": true }
66-
},
6755
"geofla:dpt": { "@omitDefault": true, "@explicit": true },
6856
"geofla:codeReg": { "@omitDefault": true, "@explicit": true },
6957
"rico:isOrWasContainedBy": {
7058
"@omitDefault": true,
7159
"@explicit": true,
72-
"@id": {},
7360
"rdfs:label": { "@omitDefault": true }
7461
},
7562
"rico:isOrWasAdjacentTo": {
7663
"@omitDefault": true,
7764
"@explicit": true,
78-
"@id": {},
7965
"rdfs:label": { "@omitDefault": true }
8066
},
8167
"rico:isOrWasPartOf": {
8268
"@omitDefault": true,
8369
"@explicit": true,
84-
"@id": {},
8570
"rdfs:label": { "@omitDefault": true }
8671
},
8772
"rico:hasOrHadPhysicalLocation": {
@@ -102,10 +87,6 @@
10287
"rico:isOrWasCoordinatesOf": { "@omitDefault": true },
10388
"rico:measure": { "@omitDefault": true, "@explicit": true },
10489
"rico:geodesicSystem": { "@omitDefault": true, "@explicit": true }
105-
},
106-
"rico:isOrWasCoordinatesOf": {
107-
"@omitDefault": true,
108-
"@explicit": true
10990
}
11091
},
11192
"rico:thingIsTargetOfWholePartRelation": {
@@ -126,19 +107,16 @@
126107
"rico:precedesInTime": {
127108
"@omitDefault": true,
128109
"@explicit": true,
129-
"@id": {},
130110
"rdfs:label": { "@omitDefault": true }
131111
},
132112
"rico:followsInTime": {
133113
"@omitDefault": true,
134114
"@explicit": true,
135-
"@id": {},
136115
"rdfs:label": { "@omitDefault": true }
137116
},
138117
"rico:containsOrContained": {
139118
"@omitDefault": true,
140119
"@explicit": true,
141-
"@id": {},
142120
"rdfs:label": { "@omitDefault": true }
143121
}
144122
}

src/_layouts/place.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525

2626

2727
{# first parameter is the object to print, second parameter is the main entity printed #}
28-
{{ jsonld.render('', headerData) }}
28+
{{ jsonld.render(place, headerData) }}

0 commit comments

Comments
 (0)