Open Semantic Framework PHP API  3.0
 All Data Structures Namespaces Files Functions Variables Pages
CrudReadQuery.php
Go to the documentation of this file.
1 <?php
2 
5 
11 
55  class CrudReadQuery extends \StructuredDynamics\osf\php\api\framework\WebServiceQuery
56  {
65  function __construct($network, $appID, $apiKey, $userID)
66  {
67  // Set the OSF network & credentials to use for this query.
68  $this->setNetwork($network);
69  $this->appID = $appID;
70  $this->apiKey = $apiKey;
71  $this->userID = $userID;
72 
73  // Set default configarations for this web service query
74  $this->setSupportedMimes(array("text/xml",
75  "application/json",
76  "application/rdf+xml",
77  "application/rdf+n3",
78  "application/iron+json",
79  "application/iron+csv"));
80 
81  $this->setMethodPost();
82 
83  $this->mime("resultset");
84 
85  $this->setEndpoint("crud/read/");
86 
87  // Set default parameters for this query
88  $this->excludeLinksback();
89  $this->excludeReification();
90  $this->sourceInterface("default");
91  }
92 
105  public function uri($uris)
106  {
107  if(!is_array($uris))
108  {
109  $this->params["uri"] = urlencode($uris);
110  }
111  else
112  {
113  foreach($uris as $key => $uri)
114  {
115  $uris[$key] = str_replace(";", "%3B", $uri);
116  }
117 
118  $this->params["uri"] = urlencode(implode(";", $uris));
119  }
120 
121  return($this);
122  }
123 
142  public function dataset($uris)
143  {
144  if(!is_array($uris))
145  {
146  $this->params["dataset"] = urlencode($uris);
147  }
148  else
149  {
150  // Encode potential ";" characters
151  foreach($uris as $key => $uri)
152  {
153  $uris[$key] = str_replace(";", "%3B", $uri);
154  }
155 
156  $this->params["dataset"] = urlencode(implode(";", $uris));
157  }
158 
159  return($this);
160  }
161 
170  public function includeLinksback()
171  {
172  $this->params["include_linksback"] = "True";
173 
174  return($this);
175  }
176 
187  public function excludeLinksback()
188  {
189  $this->params["include_linksback"] = "False";
190 
191  return($this);
192  }
193 
203  public function includeReification()
204  {
205  $this->params["include_reification"] = "True";
206 
207  return($this);
208  }
209 
221  public function excludeReification()
222  {
223  $this->params["include_reification"] = "False";
224 
225  return($this);
226  }
227 
241  public function lang($lang = 'en')
242  {
243  $this->params["lang"] = strtolower($lang);
244 
245  return($this);
246  }
247 
263  public function includeAttributes($attributes)
264  {
265  // Encode potential ";" characters
266  foreach($attributes as $key => $attribute)
267  {
268  $attributes[$key] = str_replace(";", "%3B", $attribute);
269  }
270 
271  $this->params["include_attributes_list"] = urlencode(implode(";", $attributes));
272 
273  return($this);
274  }
275  }
276 
278 ?>
Crud Read Query to a OSF Crud Read web service endpoint.
includeLinksback()
Specifies that the reference to the other instance records referring to the target instance record wi...
uri($uris)
Set the URI(s) of the records' description needed to be returned by the user.
excludeReification()
Specifies that you want to exclude the reification information for the returned records.
includeReification()
Specifies that you want to include the reification information for the returned records.
dataset($uris)
Set the URI(s) of the dataset where the instance record is indexed.
__construct($network, $appID, $apiKey, $userID)
Constructor.
includeAttributes($attributes)
Set a list of attribute URIs to include in the resultset returned by the endpoint.
excludeLinksback()
Specifies that the reference to the other instance records referring to the target instance record wo...
lang($lang= 'en')
Specifies the language of the records to be returned by the search endpoint.