Skip to content

Commit

Permalink
remove dulicate avatars
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofstetter Benjamin (extern) committed Feb 9, 2025
1 parent 330d125 commit d94033f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src-vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-rdf-sketch",
"displayName": "RDF Sketch",
"description": "Graphical rendering of RDF data",
"version": "1.0.3",
"version": "1.0.5",
"license": "MIT",
"icon": "images/zazuko.png",
"publisher": "Zazuko",
Expand Down
3 changes: 2 additions & 1 deletion src/resources-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ export function resourcesFromDataset(dataset: Dataset): Resource[] {
const resources = [...nodeSet].map(node => {
const quads = dataset.match(node);
const rdfClasses = [...quads].filter(quad => quad.predicate.equals(rdfEnvironment.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'))).map(quad => quad.object.value);
const avatars = rdfClasses.map(rdfClass => {
const avatarsWithDuplicates = rdfClasses.map(rdfClass => {
return {
label: mapTypeToLabel(rdfClass),
color: mapTypeToColor(rdfClass),
iri: rdfClass
}
});
const avatars = avatarsWithDuplicates.filter((avatar, index) => avatarsWithDuplicates.findIndex(a => a.iri === avatar.iri) === index);
const properties = [...quads].reduce((acc, { predicate, object }) => {
if (!acc.has(predicate.value)) {
const property = {
Expand Down

0 comments on commit d94033f

Please sign in to comment.