Created
October 6, 2016 06:40
-
-
Save jindrichmynarz/2ee1cb5ae56a2ca92297aa633443f13b to your computer and use it in GitHub Desktop.
Fuse resources by key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX : <http://example.com/> | |
DELETE { | |
?r ?outP ?outO . | |
?inS ?inP ?r . | |
} | |
INSERT { | |
?sampleR ?outP ?outO . | |
?inS ?inP ?sampleR . | |
} | |
WHERE { | |
{ | |
SELECT ?class ?name (SAMPLE(?r) AS ?sampleR) | |
WHERE { | |
# Select resources to fuse. | |
?r a ?class ; | |
:name ?name . | |
} | |
# Group by key(s) | |
GROUP BY ?class ?name | |
} | |
?r a ?class ; | |
:name ?name . | |
FILTER (!sameTerm(?r, ?sampleR)) | |
?r ?outP ?outO . | |
OPTIONAL { | |
?inS ?inP ?r . | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment