Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: ActivityStreams JSON-LD #85

Open
sebilasse opened this issue Nov 5, 2022 · 1 comment
Open

Idea: ActivityStreams JSON-LD #85

sebilasse opened this issue Nov 5, 2022 · 1 comment

Comments

@sebilasse
Copy link

sebilasse commented Nov 5, 2022

Hey Max,

a feature request:

currently I am using the simplified versions of getManyEntities reducing it for simplify like

.reduce((oneObject, fromMany) => {
    for (const wikibaseId in fromMany) {
      oneObject[wikibaseId] = fromMany[wikibaseId];
    }
    return o;
  }, {});

then I do map it to an ActivityStreams JSON-LD "type": "Profile" with e.g. "describes": "wdt:Q1055"
(
simple, with default AS context and "wdt" prefix for wikidata
and in the following example
alternativeNameMap: { "@id": "wdt:P4970", "@container": "@language" },
)
by just renaming
modified -> updated
labels -> nameMap
aliases -> alternativeNameMap
descriptions -> summaryMap
and prefixing other properties with "wdt:" we would have a nice ActivityStreams representation for further use in ActivityPub.
I do also have a mapping from all properties to tag, url, image, icon
I mean, ActivityStreams is well defined and it would just need a few changes and could become a valuable option.

const res: any = {
  id: wd.id,
  updated: wd.modified || new Date().toISOString(),
  nameMap: wd.claims && wd.claims.labels ? wd.claims.labels : {},
  alternativeNameMap: wd.claims && wd.claims.aliases ? wd.claims.aliases : {},
  summaryMap: wd.claims && wd.claims.descriptions  ? wd.claims.descriptions : {},
  tag: [],
  url: [],
  image: [],
  icon: [],
  // all wikidata properties as "wdt:P..."
};
@maxlath
Copy link
Owner

maxlath commented Nov 9, 2022

Hi Seb!
This seems to be quite specific to a certain use case, I don't think it belongs in this lib, but if you turn it into a lib, I would happily link to it from this repo's readme "see also" section :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants