-
Notifications
You must be signed in to change notification settings - Fork 47
/
9-similarity_search.sparql
42 lines (36 loc) · 1.1 KB
/
9-similarity_search.sparql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
prefix : <http://schema.org/>
prefix t: <http://www.imdb.com/title/>
prefix spa: <tag:stardog:api:analytics:>
SELECT ?similarMovieLabel ?confidence
WHERE {
graph spa:model {
:s1 spa:arguments (?genres ?directors ?authors ?producers ?metaCritic) ;
spa:confidence ?confidence ;
spa:parameters [ spa:limit 5 ] ;
spa:predict ?similarMovie .
}
{ ?similarMovie rdfs:label ?similarMovieLabel }
{
SELECT
(spa:set(?genre) as ?genres)
(spa:set(?director) as ?directors)
(spa:set(?author) as ?authors)
(spa:set(?producer) as ?producers)
?metaCritic
?movie
{
?movie :genre ?genre ;
:director ?director ;
:author ?author .
OPTIONAL {
?movie :productionCompany ?producer .
}
OPTIONAL {
?movie :metaCritic ?metaCritic .
}
VALUES ?movie { t:tt0118715 } # The Big Lebowski
}
GROUP BY ?movie ?metaCritic
}
}
ORDER BY DESC(?confidence)