Last change
on this file since 40 was
40,
checked in by basvannuland, 14 years ago
|
added database readers and writers for application info and facilitator info
possible to store survey application and creator info
|
File size:
952 bytes
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | class UserRDFWriter
|
---|
4 | {
|
---|
5 |
|
---|
6 | protected $model;
|
---|
7 | protected $fileName = 'users/users.rdf';
|
---|
8 |
|
---|
9 | public function __construct()
|
---|
10 | {
|
---|
11 | // Create empty MemModel
|
---|
12 | $factory = new ModelFactory();
|
---|
13 | $this->model = $factory->getDefaultModel();
|
---|
14 |
|
---|
15 | if(file_exists($this->fileName))
|
---|
16 | $this->model->load($this->fileName);
|
---|
17 | }
|
---|
18 |
|
---|
19 | public function saveUsers()
|
---|
20 | {
|
---|
21 | $this->model->saveAs($this->fileName,'rdf');
|
---|
22 | }
|
---|
23 |
|
---|
24 | public function addNewUser($name)
|
---|
25 | {
|
---|
26 | $userID = md5( uniqid(rand(), true) );
|
---|
27 |
|
---|
28 | $resourceUser = new Resource(USER . '/' . $userID);
|
---|
29 |
|
---|
30 | $resourceUserType = new Resource(USER);
|
---|
31 | $predicateRType = new Resource(RTYPE);
|
---|
32 | $this->model->add(new Statement($resourceUser,$predicateRType,$resourceUserType));
|
---|
33 |
|
---|
34 | $literalUserID = new Literal($userID);
|
---|
35 | $predicateUniqueID = new Resource(UID);
|
---|
36 | $this->model->add(new Statement($resourceUser,$predicateUniqueID,$literalUserID));
|
---|
37 | }
|
---|
38 |
|
---|
39 | }
|
---|
40 |
|
---|
41 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.