Changeset 29


Ignore:
Timestamp:
Jul 13, 2011, 1:33:27 PM (14 years ago)
Author:
cla
Message:

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
Location:
php/trunk/classes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • php/trunk/classes/rdfa_Data.php

    r28 r29  
    2323 *  \class  Data
    2424 *  \brief  This class implements a RDF data class as described in the
    25  *          RDF API and RDFa API specs of W3C.
     25 *          \c RDF \c API and \c RDFa \c API specs of W3C.
    2626 *  \author Christian Langanke
    2727 *  \author Adrian Gschwend
     
    342342   * Sets short-hand IRI mappings that are used by the API to map URIs to CURIEs.
    343343   *
    344    * \param prefix         namespace prefix of the mapping
    345    * \param uriNamespace   namespace base URI of the mapping
     344   * \param prefix         Namespace prefix of the mapping
     345   * \param uriNamespace   Namespace base URI of the mapping
     346   * \retval void
     347   *
     348   * \note The return value
     349   * - is not described in the \c RDFa \c API specification
     350   * - should be a string in the \c RDF \c API, but the value is not described
    346351   */
    347352  public function setMapping( $prefix, $uriNamespace) {
     
    350355      $this->debugger->sendMessage( $debugmessage,
    351356                                    self::debugcontext);
     357    return;
    352358  } // public function setMapping
    353359
     
    360366   *
    361367   * \param curie            CURIE to be resolved to a URI
     368   * \retval string          URI
     369   * \retval NULL            Mapping could not be found
    362370   *
    363371   * \note This method is a library specific extension to the RDF API and RDFa API
     
    399407   *
    400408   * \param uri            URI to be shrinked to a CURIE
     409   * \retval string        CURIE or URI
    401410   *
    402411   * \note This method is a library specific extension to the RDF API and RDFa API
     
    432441   * Parses RDF data from a URI.
    433442   *
    434    * \param toparse            resource to parse from. This can be a URI or an object of SparqlQuery
     443   * \param toparse            Resource to parse from. This can be a URI or an object of SparqlQuery
     444   * \retval boolean           true: the parsed graph contains data
     445   * \retval boolean           false: the parsed graph contains no data
    435446   *
    436447   * \note
     
    438449   * - Parsing from a SPARQL CONSTRUCT query by using a SparqlQuery object, is a library specific
    439450   *   extension to both the RDF API and RDFa API.
     451   * - On all consecutive calls to parse, the newly parsed graph is merged into the existing graph.
     452   *   Such a feature is not described in the W3C specs
    440453   */
    441454  public function parse( $toparse) {
     
    471484
    472485    }
     486    // could something be parsed ?
     487    $result = (count( $newTriples) > 0);
    473488
    474489    // determine operation mode
     
    490505    $this->debugger->sendMessage( $debugMessage, self::debugcontext);
    491506
     507    return $result;
     508
    492509  } //   public function parse
    493510
     
    503520   * Retrieves a list of all values expressed in the RDF Data that match the given subject and property.
    504521   *
    505    * \param property     property that the subject should be linked with
    506    * \param value        value that the specified property should have
     522   * \param property     Property that the subject should be linked with
     523   * \param value        Value that the specified property should have
     524   * \retval array       List of subjects
     525   * \retval boolean     false: the graph contains no data
    507526   *
    508527   * If no arguments are provided, all values from within the RDF data are returned.
     
    552571   * Retrieves a list of all properties expressed in the RDF data that match the given subject.
    553572   *
    554    * \param subject   subject to be searched
     573   * \param subject   Subject to be searched
     574   * \retval array    List of properties
     575   * \retval boolean  false: the subject was not found
    555576   *
    556577   * If a subject is not provided, all properties expressed in the RDF data are returned.
     
    599620
    600621  /**
    601    * Retrieves an associative list of unique properties with their values expressed in the RDF data
    602    * that match the given subject. All non-unique properties are <i>NOT</i> returned !
    603    *
    604    * \param subject   subject to be searched
     622   * Gets an associative list of unique properties with their values
     623   * expressed in the RDF data that match the given subject.
     624   *
     625   * \param subject   Subject to be searched
     626   * \retval array    Associative list of unqique properties and their values
     627   * \retval boolean  false: the subject could not be found
    605628   *
    606629   * If a subject isn't provided, all unique properties expressed in the RDF data are returned.
    607630   *
    608    * \note This method is a library specific extension to the RDF API and RDFa API
     631   * \note
     632   * - All non-unique properties are \c NOT returned !
     633   * - This method is a library specific extension to the RDF API and RDFa API
    609634   */
    610635  public function _getUniqueProperties( $subject = Null) {
     
    658683   * Retrieves a list of all values expressed in the RDF data that match the given subject and property.
    659684   *
    660    * \param subject   subject to be searched
    661    * \param property  property to be searched
     685   * \param subject   Subject to be searched
     686   * \param property  Property to be searched
     687   * \retval array    List of values
     688   * \retval boolean  false: a matching subject was not found
    662689   *
    663690   * If no arguments are provided, all values expressed in the RDF data are returned.
     
    709736   * Retrieves the first available value expressed in the RDF data that matches the given subject and property.
    710737   *
    711    * \param subject   subject to be searched
    712    * \param property  property to be searched
     738   * \param subject   Subject to be searched
     739   * \param property  Property to be searched
     740   * \retval string   First value of the property
     741   * \retval boolean  false: the subject could not be found
    713742   *
    714743   * If no arguments are provided, the first value expressed in the RDF data is returned.
     
    760789   * Sets a property value for a subject.
    761790   *
    762    * \param subject   subject to get the property set
    763    * \param property  property to be added
    764    * \param value     value to be set for the property
    765    * \param type      the type of the value, either 'uri', 'literal' or 'bnode'
     791   * \param subject   Subject to get the property set
     792   * \param property  Property to be added
     793   * \param value     Value to be set for the property
     794   * \param type      The type of the value, either 'uri', 'literal' or 'bnode'
    766795   *                  (case-insensitive). Specifying the first character is sufficient.
    767796   *                  If not specified, strings starting with 'http://' are taken as a URI,
    768797   *                  otherwise as a literal
    769    * \retval true property value set
    770    * \retval false subject not found or invalid value type specified
     798   * \retval boolean  true: property value set \n
     799   *                  false: subject not found or invalid value type specified
    771800   *
    772801   * \see rdfa::Projection::set
     
    781810
    782811    // insert code here
     812   
     813    return $result;
    783814
    784815  } // public function _setValue
     
    797828   * A template can be provided for the purpose of building the Projection in an application-specific way.
    798829   *
    799    * \param subject    subject to be searched
    800    * \param template   associative array( URI/CURIE => membername) as a template to be applied to the projection object
     830   * \param subject    Subject to be searched
     831   * \param template   Associative array( URI/CURIE => membername) as a template to be applied to the projection object
     832   * \retval rdfa::Projection The projection on the subject
     833   * \retval boolean   false: the subject was not found
    801834   *
    802835   */
     
    833866   * A template can be provided for the purpose of building the Projection in an application-specific way.
    834867   *
    835    * \param property   property that the subject of the projections should be linked with
    836    * \param value      value that the specified property should have
    837    * \param template   associative array( URI/CURIE => membername) as a template to be applied to the projection object
     868   * \param property   Property that the subject of the projections should be linked with
     869   * \param value      Value that the specified property should have
     870   * \param template   Associative array( URI/CURIE => membername) as a template to be applied to the projection object
     871   * \retval array     List of rdfa::Projection as projections on the matching subjects
     872   * \retval boolean   false: a matching subject was not found
    838873   *
    839874   * If no arguments are provided, projections are created for all subjects from within the RDF data.
     
    879914   * A template can be provided for the purpose of building the Projection in an application-specific way.
    880915   *
    881    * \param query      an associative array( URI/CURIE => value) specifying a multiple property filter
    882    * \param template   associative array( URI/CURIE => membername) as a template to be applied to the projection object
     916   * \param query      An associative array( URI/CURIE => value) specifying a multiple property filter
     917   * \param template   An associative array( URI/CURIE => membername) as a template to be applied to the projection object
     918   * \retval array     List of rdfa::Projection as projections on the matching subjects
     919   * \retval boolean   false: a matching subject was not found
    883920   *
    884921   * If no arguments are provided, projections are created for all subjects from within the RDF data.
     
    9841021   * Returns a serialization of the triple data.
    9851022   *
    986    * \param type     Supported RDF serialization MIME Media Types according to http://www.iana.org/assignments/media-types/index.html
     1023   * \param type       Supported RDF serialization MIME Media Types according to http://www.iana.org/assignments/media-types/index.html
     1024   * \retval string    Serialization of the graph data
     1025   * \retval boolean   false: the serialization type is invalid
    9871026   *
    9881027   * Currently supported mime type identifiers are:
     
    10271066        $ser = \ARC2::getRDFXMLSerializer();
    10281067        break;
    1029      
     1068
    10301069      case 'turtle':
    10311070        $ser = \ARC2::getTurtleSerializer();
  • php/trunk/classes/rdfa_Projection.php

    r28 r29  
    4949   * Creates a Projection instance from a Data instance, reflecting a given subject in the triple data.
    5050   *
    51    * \param rdfaData     instance of Reader holding the RDF data
    52    * \param subject      subject of the projection
    53    * \param template     template array specifying the members to be created from data linked to the subject
     51   * \param rdfaData     instance of rdfa::Data holding the graph of the subject
     52   * \param subject      Subject of the projection
     53   * \param template     Associative array( URI/CURIE => membername) as a template to be applied to the projection object
     54   *
     55   * \exception Exception The parameter rdfaData is not of object rdfa::Data
    5456   *
    5557   * \note A projection is to be created by the following methods only:
     
    9799  /**
    98100   * Gets properties of the subject of the projection.
    99    * Returns a list of properties.
     101   *
     102   * \retval array List of properties
    100103   */
    101104  public function getProperties() {
     
    106109
    107110  /**
    108    * Gets unique properties of the subject of the projection.
     111   * Gets an associative list of unique properties of the projection
     112   * with their values.
    109113   *
    110    * Ths method returns an associative list of properties => values.
    111    * All non-unique properties are NOT returned !
     114   * \retval array  Associative list of unqique properties and their values
    112115   *
    113    * \note This method is a library specific extension to the RDF API and RDFa API
    114    *
     116   * \note
     117   * - All non-unique properties are \c NOT returned !
     118   * - This method is a library specific extension to the RDF API and RDFa API
    115119   */
    116120  public function _getUniqueProperties() {
     
    122126  /**
    123127   * Gets the subject of of the subject of the projection.
     128   *
     129   * \retval string  Subject of the property
    124130   */
    125131  public function getSubject() {
     
    132138   * Gets the first available value of a given property.
    133139   *
    134    * \param property   property to retrieve the first value of
     140   * \param  property   Property to retrieve the first value of#
     141   * \retval string     First value of the property
    135142   */
    136143
     
    144151   * Gets a list of all available values of a given property.
    145152   *
    146    * \param property   property to retrieve all values of
     153   * \param property   Property to retrieve all values of
    147154   */
    148155
     
    150157    return $this->rdfaData->getValues( $this->subject, $property);
    151158  } // public function getAll
    152  
     159
    153160  // --------------------------------------------------------
    154161
     
    156163   * Sets a property value.
    157164   *
    158    * \param property  property to be added
    159    * \param value     value to be set for the property
    160    * \param type      the type of the value, either 'uri', 'literal' or 'bnode'
     165   * \param property  Property to be added
     166   * \param value     Value to be set for the property
     167   * \param type      The type of the value, either 'uri', 'literal' or 'bnode'
    161168   *                  (case-insensitive). Specifying the first character is sufficient.
    162169   *                  If not specified, strings starting with 'http://' are taken as a URI,
    163170   *                  otherwise as a literal
    164    * \retval object projection
    165    * \retval false invalid value type specified
     171   * \retval rdfa::Projection Success
     172   * \retval boolean   false: invalid value type specified
    166173   *
    167174   * \see rdfa::Data::setValue
  • php/trunk/classes/rdfa_SparqlEndpoint.php

    r17 r29  
    4949   * Creates an endpoint configuration class instance.
    5050   *
    51    * \param aconfig    associative list of configuration data
     51   * \param aconfig    Associative list of configuration data
    5252   */
    5353  public function __construct( $aconfig) {
     
    5858    // initialize instance vars
    5959    $this->aconfig = array();
    60    
     60
    6161    // store inital configuration
    6262    if (is_array( $aconfig)) {
     
    7979   * Sets a single configuration value
    8080   *
    81    * \param name   name of the configurarion value
    82    * \param value  new value to be set
     81   * \param name   Name of the configurarion value
     82   * \param value  New value to be set
     83   * \retval void
    8384   */
    8485  public function setConfigurationValue( $name, $value) {
     
    9394   * Gets a single configuration value
    9495   *
    95    * \param name   name of the configurarion value
     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
    9699   */
    97100  public function getConfigurationValue( $name) {
     
    106109  /**
    107110   * Queries an associative list of the configuration values
     111   *
     112   * \retval array  Associative list of the configuration data
    108113   */
    109114  public function getConfigurationValues( ) {
  • php/trunk/classes/rdfa_SparqlQuery.php

    r28 r29  
    5353   * \param statement    SPARQL CONSTRUCT query statement to execute.
    5454   *
     55   * \exception Exception The parameter endpoint is not of object rdfa::SparqlEndpoint
     56   *
    5557   * \note To effectively execute the query, invoke the method
    5658   * - rdfa::SparqlQuery::run()
     
    8587  /**
    8688   * Gets the SPARQL query statementof the object.
     89   *
     90   * \retval string SPARQL statement
    8791   */
    8892
     
    96100   * Runs the SPARQL query of the object.
    97101   *
    98    * Returns indexed RDF data.
     102   * \retval array  indexed RDF data in internal format
    99103   */
    100104
Note: See TracChangeset for help on using the changeset viewer.