Changeset 62 for Dev/trunk/classes/ApplicationRDFReader.php
- Timestamp:
- 07/29/11 14:51:06 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/ApplicationRDFReader.php
r45 r62 3 3 class ApplicationRDFReader 4 4 { 5 6 5 protected $model; 6 7 7 public function __construct() 8 8 { 9 10 11 12 13 14 15 16 9 // Create empty MemModel 10 $factory = new ModelFactory(); 11 $this->model = $factory->getDefaultModel(); 12 13 $fileName = 'data/applications/applications.rdf'; 14 15 if(file_exists($fileName)) 16 $this->model->load($fileName); 17 17 } 18 19 20 21 22 PREFIXpredicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>23 PREFIXresources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>24 SELECT?title ?description ?style25 26 27 28 predicates:uid"' . $applicationID . '" ;29 predicates:title?title ;30 31 predicates:style?style32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 PREFIXpredicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>54 PREFIXresources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>55 SELECT?uid56 57 58 59 predicates:uid?uid60 61 62 63 64 65 66 67 68 69 70 PREFIXpredicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>71 PREFIXresources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>72 SELECT?title73 74 75 76 predicates:title?title77 78 79 80 81 82 83 84 85 86 87 PREFIXpredicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>88 PREFIXresources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>89 SELECT?description90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 PREFIXpredicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>105 PREFIXresources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>106 SELECT?style107 108 109 110 predicates:style?style111 112 113 114 115 116 18 19 public function readApplicationInfo($applicationID) 20 { 21 $querystring = ' 22 PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> 23 PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> 24 SELECT ?title ?description ?style 25 WHERE 26 { 27 _application predicates:resource_type resources:application ; 28 predicates:uid "' . $applicationID . '" ; 29 predicates:title ?title ; 30 prdeicates:description ?description ; 31 predicates:style ?style 32 }'; 33 34 $result = $this->model->sparqlQuery($querystring); 35 36 return $result; 37 } 38 39 public function readAllApplications() 40 { 41 $result = array(); 42 $result[] = $this->readApplicationIDs(); 43 $result[] = $this->readApplicationTitles(); 44 $result[] = $this->readApplicationDescriptions(); 45 $result[] = $this->readApplicationStyles(); 46 47 return $restult; 48 } 49 50 public function readApplicationIDs() 51 { 52 $querystring = ' 53 PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> 54 PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> 55 SELECT ?uid 56 WHERE 57 { 58 _application predicates:resource_type resources:application ; 59 predicates:uid ?uid 60 }'; 61 62 $result = $this->model->sparqlQuery($querystring); 63 64 return $result; 65 } 66 67 public function readApplicationTitles() 68 { 69 $querystring = ' 70 PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> 71 PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> 72 SELECT ?title 73 WHERE 74 { 75 _application predicates:resource_type resources:application ; 76 predicates:title ?title 77 }'; 78 79 $result = $this->model->sparqlQuery($querystring); 80 81 return $result; 82 } 83 84 public function readApplicationDescriptions() 85 { 86 $querystring = ' 87 PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> 88 PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> 89 SELECT ?description 90 WHERE 91 { 92 _application predicates:resource_type resources:application ; 93 prdeicates:description ?description 94 }'; 95 96 $result = $this->model->sparqlQuery($querystring); 97 98 return $result; 99 } 100 101 public function readApplicationStyles() 102 { 103 $querystring = ' 104 PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> 105 PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> 106 SELECT ?style 107 WHERE 108 { 109 _application predicates:resource_type resources:application ; 110 predicates:style ?style 111 }'; 112 113 $result = $this->model->sparqlQuery($querystring); 114 115 return $result; 116 } 117 117 } 118 118
Note: See TracChangeset
for help on using the changeset viewer.