source: php/trunk/classes/rdfa_SparqlEndpoint.php@ 29

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

rdfint

  • all classes: added missing comments on return value
  • Projection::construct and rdfa::SparqlQuery: added missing comment on exceptions
  • Data::parse
    • added note on merge feature
    • added code to return boolean
  • Property svn:eol-style set to native
File size: 3.3 KB
Line 
1<?php
2
3/* RDFInt.php - RDF Interfaces for PHP
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
25 * for creation of rdfa::SparqlQuery objects.
26 * <br>This is a library specific extension to the RDF API and RDFa API.
27 * \author Christian Langanke
28 * \author Adrian Gschwend
29 * \date 2011
30 */
31
32class SparqlEndpoint {
33
34 /**
35 * Version of the class
36 */
37 const version = '1.0.0';
38 /**
39 * Name of the fDebug context
40 */
41 const debugcontext = 'RDFA_SPARQLENDPOINT';
42
43 private $debugger;
44 private $aconfig;
45
46 // ---------------------------------------
47
48 /**
49 * Creates an endpoint configuration class instance.
50 *
51 * \param aconfig Associative list of configuration data
52 */
53 public function __construct( $aconfig) {
54
55 // setup debugger
56 $this->debugger = \fDebug::getInstance();
57
58 // initialize instance vars
59 $this->aconfig = array();
60
61 // store inital configuration
62 if (is_array( $aconfig)) {
63 $this->aconfig = $aconfig;
64 $debugmessage = "Creating endpoint configuration\n";
65 foreach ($aconfig as $name => $value) {
66 $debugmessage .= "$name=$value\n";
67 }
68 $this->debugger->sendMessage( $debugmessage, self::debugcontext);
69 } else {
70 $debugmessage = "Missing configuration parameters provided for endpoint configuration!";
71 $this->debugger->sendWarning( $debugmessage, self::debugcontext);
72 }
73
74 } // public function __construct
75
76 // ---------------------------------------
77
78 /**
79 * Sets a single configuration value
80 *
81 * \param name Name of the configurarion value
82 * \param value New value to be set
83 * \retval void
84 */
85 public function setConfigurationValue( $name, $value) {
86 $this->debugger->sendMessage( "Send endpoint configuration value $name=$value", self::debugcontext);
87 $this->aconfig[ $name] = $value;
88 return;
89 }
90
91 // ---------------------------------------
92
93 /**
94 * Gets a single configuration value
95 *
96 * \param name Name of the configurarion value
97 * \retval string Value of the specified configuration value
98 * \retval boolean false: the configuration value was not found
99 */
100 public function getConfigurationValue( $name) {
101 if (!isset( $this->aconfig[ $name]))
102 return false;
103 else
104 return $this->aconfig[ $name];
105 }
106
107 // ---------------------------------------
108
109 /**
110 * Queries an associative list of the configuration values
111 *
112 * \retval array Associative list of the configuration data
113 */
114 public function getConfigurationValues( ) {
115 return $this->aconfig;
116 }
117
118} // class SparqlEndpoint
119
120?>
Note: See TracBrowser for help on using the repository browser.