forked from annienyamekye1/gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
46 lines (43 loc) · 1.4 KB
/
functions.php
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
<?php
require_once( "sparql_library.php" );
class Functions{
private $db;
public function __construct(){
$db = sparql_connect( "http://localhost:3030/ArtGallery/sparql" );
if( !$db ) { print sparql_errno() . ": ---" . sparql_error(). "\n"; exit; }
sparql_ns( "mov","http://www.moviemania.com/ontology#" );
}
public function get_languages(){
$sparql = "SELECT ?name
WHERE {
?x a mov:Spoken_Language.
?x mov:name ?name.
}";
$result = sparql_query( $sparql );
return $result;
}
public function get_genres() {
$sparql = "SELECT ?name ?link
WHERE {
?x a mov:Genre.
?x mov:name ?name.
?x mov:thumbnail_url ?link
}";
$result = sparql_query( $sparql );
if( !$result ) { print sparql_errno() . ": " . sparql_error(). "\n"; exit; }
return $result;
}
public function get_movies($language) {
$sparql = " SELECT ?name
WHERE {
?x a mov:Movie.
?x mov:spoken_language ?lang.
?x mov:title ?name.
?lang mov:name '".$language."'.
}";
$result = sparql_query( $sparql );
if( !$result ) { print sparql_errno() . ": " . sparql_error(). "\n"; exit; }
return $result;
}
}
?>