[212] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * Description of ResearchToolObject |
---|
| 4 | * |
---|
| 5 | * @author jkraaijeveld |
---|
| 6 | */ |
---|
[233] | 7 | // Survey database interface class as intermediate for storing data from the site to the RDF database |
---|
| 8 | require_once 'rdfConstants.php'; |
---|
| 9 | // Include RAP Library to write RDF files |
---|
| 10 | include(RDFAPI_INCLUDE_DIR . "RDFAPI.php"); |
---|
| 11 | |
---|
| 12 | |
---|
[212] | 13 | abstract class ResearchToolObject { |
---|
| 14 | |
---|
| 15 | public $uid; |
---|
| 16 | |
---|
| 17 | public function evaluate() |
---|
| 18 | { |
---|
| 19 | return true; |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | public static function load($filename) |
---|
| 23 | { |
---|
| 24 | $model = ModelFactory::getDefaultModel(); |
---|
| 25 | if(file_exists($filename)) |
---|
| 26 | $model->load($filename); |
---|
| 27 | return $model; |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | /** |
---|
| 31 | * function createArguments() |
---|
| 32 | * @param type $arguments |
---|
| 33 | * Creates the arguments to be used in the query based on the |
---|
| 34 | * arguments specified in the incoming array. |
---|
| 35 | */ |
---|
| 36 | public static function createArguments($arguments) |
---|
| 37 | { |
---|
| 38 | $argumentString = ""; |
---|
| 39 | foreach(array_keys($arguments) as $key) |
---|
| 40 | { |
---|
| 41 | $addition = ""; |
---|
| 42 | switch($key) |
---|
| 43 | { |
---|
| 44 | case "uid" : $addition = "predicates:uid '" . $arguments[$key] . "'\n"; break; |
---|
| 45 | case "question" : $addition = "predicates:question_code '" . $arguments[$key] . "'\n"; break; |
---|
| 46 | case "values": foreach($arguments[$key] as $value) { $addition = $addition . "predicates:answered '" . $value . "'\n"; } break; |
---|
| 47 | case "survey" : $addition = "predicates:for_survey '" . $arguments[$key] . "'\n"; break; |
---|
| 48 | case "respondent" : $addition = "predicates:by_respondent '" . $arguments[$key] . "'\n"; break; |
---|
| 49 | case "answers" : foreach($arguments[$key] as $answer) { $addition = $addition . "predicates:given_answer '" . $answer . "'\n"; } break; |
---|
| 50 | case "title" : $addition = "predicates:title '" . $arguments[$key] . "'\n"; break; |
---|
| 51 | case "description" : $addition = "predicates:description '" . $arguments[$key] . "'\n"; break; |
---|
| 52 | case "style" : $addition = "predicates:style '" . $arguments[$key] . "'\n"; break; |
---|
| 53 | case "code" : $addition = "predicates:question_code '" . $arguments[$key] . "'\n";break; |
---|
| 54 | case "type" : $addition = "predicates:question_type '" . $arguments[$key] . "'\n"; break; |
---|
| 55 | case "category" : $addition = "predicates:question_category '" . $arguments[$key] . "'\n"; |
---|
| 56 | case "definedanswers" : foreach($arguments[$key] as $answer) { $addition = $addition . "predicates:has_answer '" . $answer . "'\n"; } break; |
---|
| 57 | case "name" : $addition = "predicates:name '" . $arguments[$key] . "'\n"; break; |
---|
| 58 | case "password" : $addition = "predicates:password '" . $arguments[$key] . "'\n"; break; |
---|
| 59 | case "creator" : $addition = "predicates:creator '" . $arguments[$key] . "'\n"; break; |
---|
| 60 | case "creationdate" : $addition = "predicates:creationdate '" . $arguments[$key] . "'\n"; break; |
---|
| 61 | case "applications" : foreach($arguments[$key] as $application) { $addition = $addition . "predicates:has_application '" . $application . "'\n"; } break; |
---|
| 62 | case "surveys" : foreach($arguments[$key] as $survey) { $addition = $addition . "predicates:has_survey '" . $survey . "'\n"; } break; |
---|
| 63 | case "answersets" : foreach($arguments[$key] as $answerset) { $addition = $addition . "predicates:has_answerset '" . $answerset . "'\n"; } break; |
---|
| 64 | case "questions" : foreach($arguments[$key] as $question) { $addition = $addition . "predicates:has_question '" . $question . "'\n"; } break; |
---|
| 65 | case "location" : $addition = "predicates:location '" . $arguments[$key] . "\n"; break; |
---|
| 66 | case "facilitator" : $addition = "predicates:facilitator '" . $arguments[$key] . "\n"; break; |
---|
| 67 | case "starttime" : $addition = "predicates:starttime '" . $arguments[$key] . "\n"; break; |
---|
| 68 | case "endtime" : $addition = "predicates:endtime '" . $arguments[$key] . "\n"; break; |
---|
| 69 | case "session" : $addition = "predicates:of_session '" . $arguments[$key] . "\n"; break; |
---|
| 70 | case "resultset" : $addition = "predciates:has_resultset '" . $arguments[$key] . "\n"; break; |
---|
| 71 | } |
---|
| 72 | $argumentString = $argumentString . $addition; |
---|
| 73 | } |
---|
| 74 | return $argumentString; |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | ?> |
---|