source: php/trunk/classes/rdfa_SparqlEndpoint.php

Last change on this file was 30, checked in by cla, 14 years ago

rdfint

  • added notes on incompatibility to w3c specs
  • Property svn:eol-style set to native
File size: 3.4 KB
RevLine 
[2]1<?php
2
[3]3/* RDFInt.php - RDF Interfaces for PHP
[2]4 * Copyright 2011 netlabs.org
5 * Author: Christian Langanke, Adrian Gschwend
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20namespace rdfa;
21
22/**
23 * \class SparqlEndpoint
24 * \brief This class implements the configuration class for SPARQL endpoints, used
[30]25 * for creation of rdfa::SparqlQuery objects.
[17]26 * <br>This is a library specific extension to the RDF API and RDFa API.
[30]27 * \note For further information see the section
28 * \htmllink{page_w3cspecs.html,W3C Specifications Overview and Library Compatibility}
[2]29 * \author Christian Langanke
30 * \author Adrian Gschwend
31 * \date 2011
32 */
33
34class SparqlEndpoint {
35
36 /**
37 * Version of the class
38 */
39 const version = '1.0.0';
40 /**
41 * Name of the fDebug context
42 */
43 const debugcontext = 'RDFA_SPARQLENDPOINT';
44
45 private $debugger;
46 private $aconfig;
47
48 // ---------------------------------------
49
50 /**
51 * Creates an endpoint configuration class instance.
[17]52 *
[29]53 * \param aconfig Associative list of configuration data
[2]54 */
55 public function __construct( $aconfig) {
56
57 // setup debugger
58 $this->debugger = \fDebug::getInstance();
59
60 // initialize instance vars
61 $this->aconfig = array();
[29]62
[2]63 // store inital configuration
64 if (is_array( $aconfig)) {
65 $this->aconfig = $aconfig;
66 $debugmessage = "Creating endpoint configuration\n";
67 foreach ($aconfig as $name => $value) {
68 $debugmessage .= "$name=$value\n";
69 }
70 $this->debugger->sendMessage( $debugmessage, self::debugcontext);
71 } else {
72 $debugmessage = "Missing configuration parameters provided for endpoint configuration!";
73 $this->debugger->sendWarning( $debugmessage, self::debugcontext);
74 }
75
76 } // public function __construct
77
78 // ---------------------------------------
79
80 /**
[17]81 * Sets a single configuration value
82 *
[29]83 * \param name Name of the configurarion value
84 * \param value New value to be set
85 * \retval void
[2]86 */
87 public function setConfigurationValue( $name, $value) {
88 $this->debugger->sendMessage( "Send endpoint configuration value $name=$value", self::debugcontext);
89 $this->aconfig[ $name] = $value;
90 return;
91 }
92
93 // ---------------------------------------
94
95 /**
[17]96 * Gets a single configuration value
97 *
[29]98 * \param name Name of the configurarion value
99 * \retval string Value of the specified configuration value
100 * \retval boolean false: the configuration value was not found
[2]101 */
102 public function getConfigurationValue( $name) {
103 if (!isset( $this->aconfig[ $name]))
104 return false;
105 else
106 return $this->aconfig[ $name];
107 }
108
109 // ---------------------------------------
110
111 /**
[17]112 * Queries an associative list of the configuration values
[29]113 *
114 * \retval array Associative list of the configuration data
[2]115 */
116 public function getConfigurationValues( ) {
117 return $this->aconfig;
118 }
119
120} // class SparqlEndpoint
121
122?>
Note: See TracBrowser for help on using the repository browser.