daniel added a comment. @Smalyshev mentioned that Blazegraph has a rewrite mechanism we could use to resolve redirects when processing updates and queries. That works when we know that A redirects to B (we have <A> owl:same <B>). Problems arise when a redirect is created or undone, that is, when <A> owl:same <B> is added or removed from the database:
When <A> owl:same <B> is added, we have to replace all occurrences of <A> in the graph with <B>: ?s ?p <A> becomes ?s ?p <B> ?s <A> ?o becomes ?s <B> ?o <A> ?p ?o becomes <B> ?p ?o But when <A> owl:same <B> is removed, we'd have to revert only //some// occurrences of <B> back to <A>, namely the ones that still reference A in the primary dataset on Wikidata. We'd need a way to find these. Maybe named graphs could be used to solve this? When replacing <A> with <B>, we'd copy the original triple to a secondary graph <R> (R for "redirect"; and let's call the default graph <Q> for "query"): ?s ?p <A> <Q> becomes ?s ?p <B> <Q> and ?s ?p <A> <R> ?s <A> ?o <Q> becomes ?s <B> ?o <Q> and ?s <A> ?o <R> <A> ?p ?o <Q> becomes <B> ?p ?o <Q> and <A> ?p ?o <R> We can then undo a redirect by copying the redirects backed up in the <R> graph back into the <Q> graph. All this has to be done for all URIs derived from the redirected entity ID, not just the concept URI. TASK DETAIL https://phabricator.wikimedia.org/T96490 REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>. EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: daniel Cc: Denny, mkroetzsch, Lydia_Pintscher, M.schmidt00, Beebs.systap, Haasepeter, Thompsonbry.systap, Thompsonbry, daniel, Manybubbles, Aklapper, Smalyshev, jkroll, Wikidata-bugs, Jdouglas, aude, GWicke, JanZerebecki _______________________________________________ Wikidata-bugs mailing list Wikidata-bugs@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs