Last change
on this file since 12 was
12,
checked in by basvannuland, 14 years ago
|
Added RAP RDF API
Added RDF reader writer for save and load survey
|
File size:
1.0 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | // Include RAP Library to write RDF files
|
---|
4 | define("RDFAPI_INCLUDE_DIR", "rdfapi/");
|
---|
5 | include(RDFAPI_INCLUDE_DIR . "RDFAPI.php");
|
---|
6 |
|
---|
7 | class SurveyRDFReader
|
---|
8 | {
|
---|
9 | var $model;
|
---|
10 |
|
---|
11 | var $resourceURI = 'http:/www.survey.tool/';
|
---|
12 |
|
---|
13 | public function SurveyRDFReader()
|
---|
14 | {
|
---|
15 | // Create empty MemModel
|
---|
16 | $factory = new ModelFactory();
|
---|
17 | $this->model = $factory->getDefaultModel();
|
---|
18 | }
|
---|
19 |
|
---|
20 | public function loadSurvey($sTitle)
|
---|
21 | {
|
---|
22 | $this->model->load('surveys/'.$sTitle.'.rdf');
|
---|
23 | }
|
---|
24 |
|
---|
25 | public function readSurveyTitle()
|
---|
26 | {
|
---|
27 | $querystring = '
|
---|
28 | PREFIX uri: <' . $this->resourceURI . '>
|
---|
29 | SELECT ?surveyTitle
|
---|
30 | WHERE { uri:Survey uri:Title ?surveyTitle }';
|
---|
31 |
|
---|
32 | $result = $this->model->sparqlQuery($querystring);
|
---|
33 |
|
---|
34 | return $result;
|
---|
35 | }
|
---|
36 |
|
---|
37 | public function readSurveyDescription()
|
---|
38 | {
|
---|
39 | $querystring = '
|
---|
40 | PREFIX uri: <' . $this->resourceURI . '>
|
---|
41 | SELECT ?surveyDescription
|
---|
42 | WHERE { uri:Survey uri:Description ?surveyDescription }';
|
---|
43 |
|
---|
44 | $result = $this->model->sparqlQuery($querystring);
|
---|
45 |
|
---|
46 | return $result;
|
---|
47 | }
|
---|
48 | }
|
---|
49 |
|
---|
50 | ?>
|
---|
Note: See
TracBrowser
for help on using the repository browser.