-
Notifications
You must be signed in to change notification settings - Fork 2
/
working.html
162 lines (135 loc) · 5.9 KB
/
working.html
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="A layout example with a side menu that hides on mobile, just like the Pure website.">
<title>ELAG – Bootcamp</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/pure.css">
<link rel="stylesheet" href="css/layouts/side-menu.css">
<link rel="stylesheet" href="css/elag.css">
<link rel="stylesheet" href="css/default.css">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,400,300,700,600' rel='stylesheet' type='text/css'>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
<div id="layout">
<!-- Menu toggle -->
<a href="#menu" id="menuLink" class="menu-link">
<!-- Hamburger icon -->
<span></span>
</a>
<div id="menu">
<div class="pure-menu pure-menu-open">
<a class="pure-menu-heading" href="#">AMSL</a>
<ul>
<li id="menu_item_home"><a href="index.html">Home</a></li>
<li id="menu_item_start"><a href="start.html">Start</a></li>
<li id="menu_item_install"><a href="install.html">Installation</a></li>
<li id="menu_item_templates"><a href="templates.html">Templates</a></li>
<li id="menu_item_working"><a href="working.html">SPARQL Queries</a></li>
<li id="menu_item_isql"><a href="isql.html">ISQL</a></li>
<li id="menu_item_links"><a href="links.html">Links</a></li>
</ul>
</div>
</div>
<div id="main">
<div class="header">
<h1>Working with SPARQL</h1>
<h2>Using SPARQL for querying data.</h2>
</div>
<div class="content">
<h1 id="interesting-queries">Interesting Queries</h1>
<h2 id="query-1--find-all-classes-of-the-movies-knowledge-base">Query 1 : Find all classes of the movies knowledge base</h2>
<pre><code class="sql">PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?object WHERE
{
?subject rdf:type ?object .
}
</code></pre>
<h2 id="query-2--find-all-instances-of-all-classes-of-the-movies-knowledge-base">Query 2 : Find all instances of all classes of the movies knowledge base</h2>
<pre><code class="sql">PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?subject WHERE
{
?subject rdf:type ?object .
}
</code></pre>
<h2 id="query-3--find-all-instances-of-the-class-film">Query 3 : Find all instances of the class film</h2>
<pre><code class="sql">PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?subject WHERE
{
?subject rdf:type <http://dbpedia.org/ontology/Film> .
}
</code></pre>
<h2 id="query-4--find-all-films-of-a-single-actor">Query 4 : Find all films of a single actor</h2>
<pre><code class="sql">PREFIX dbo: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/resource/>
SELECT DISTINCT ?film WHERE
{
?film dbo:starring dbpedia:Akshaye_Khanna .
}
</code></pre>
<h2 id="query-5--find-all-films-starring-maya-sansa-and-regina-orioli">Query 5 : Find all films starring Maya Sansa and Regina Orioli</h2>
<pre><code class="sql">PREFIX dbo: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/resource/>
SELECT DISTINCT ?film WHERE
{
?film dbo:starring dbpedia:Maya_Sansa .
?film dbo:starring dbpedia:Regina_Orioli .
}
</code></pre>
<h2 id="query-6--find-all-films-where-the-producer-name-contains-lee-and-the-actor-name-contains-sang-min">Query 6 : Find all films where the producer name contains ‘Lee’ and the actor name contains ‘Sang-min’</h2>
<pre><code class="sql">PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbo: <http://dbpedia.org/property/>
PREFIX dbp: <http://dbpedia.org/property/>
SELECT DISTINCT ?film ?label WHERE
{
?film dbp:producer ?producer ;
dbo:starring ?actor ;
foaf:name ?label .
FILTER regex( str(?producer), "Lee" ) .
FILTER regex( str(?actor), "Sang") .
}
ORDER BY ?label
</code></pre>
<h2 id="query-7--find-all-films-where-the-director-producer-and-actor-is-the-same-person">Query 7 : Find all films where the director, producer and actor is the same person</h2>
<pre><code class="sql">PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbp: <http://dbpedia.org/property/>
SELECT DISTINCT ?fname ?producer WHERE
{
?film dbp:producer ?producer ;
dbp:starring ?producer ;
dbo:director ?producer ;
foaf:name ?fname .
}
</code></pre>
<h2 id="query-8--find-all-films-where-the-director-producer-and-actor-is-the-same-person">Query 8 : Find all films where the director, producer and actor is the same person</h2>
<pre><code class="sql">PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbr: <http://dbpedia.org/resource/>
select distinct ?actor ?m_Hanks ?m_Depp where
{
?m_Hanks a dbo:Film ;
dbo:starring dbr:Tom_Hanks ;
dbo:starring ?actor .
?m_Depp a dbo:Film ;
dbo:starring dbr:Johnny_Depp ;
dbo:starring ?actor .
}
ORDER BY ?actor
</code></pre>
</div>
</div>
</div>
<script src="js/highlight.js"></script>
<script src="js/ui.js"></script>
<script src="js/jquery.js"></script>
<script src="js/elag.js"></script>
<script src="js/ui.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#menu_item_working").addClass("menu-item-divided pure-menu-selected");
});
</script>
</body>
</html>