Search Web Service. It searches datasets by using three filtering properties: (1) datasets, (2) types and (3) attributes, (4) attribute/value. More...

Inheritance diagram for Search:
Collaboration diagram for Search:

Public Member Functions

 __construct ($query, $types, $attributes, $datasets, $items, $page, $inference, $include_aggregates, $registered_ip, $requester_ip, $distanceFilter="", $rangeFilter="")
 Constructor.
 __destruct ()
 pipeline_getError ()
 Returns the error structure.
 pipeline_getResultset ()
 Create a resultset in a pipelined mode based on the processed information by the Web service.
 injectDoctype ($xmlDoc)
 Inject the DOCType in a XML document.
 ws_conneg ($accept, $accept_charset, $accept_encoding, $accept_language)
 Do content negotiation as an external Web Service.
 pipeline_conneg ($accept, $accept_charset, $accept_encoding, $accept_language)
 Do content negotiation as an internal, pipelined, Web Service that is part of a Compound Web Service.
 pipeline_getResponseHeaderStatus ()
 Returns the response HTTP header status.
 pipeline_getResponseHeaderStatusMsg ()
 Returns the response HTTP header status message.
 pipeline_getResponseHeaderStatusMsgExt ()
 Returns the response HTTP header status message extension.
 pipeline_serialize ()
 Serialize the web service answer.
 pipeline_serialize_reification ()
 Non implemented method (only defined).
 ws_serialize ()
 Serialize the web service answer.
 ws_respond ($content)
 Sends the HTTP response to the requester.
 process ()
 Send the search query to the system supporting this web service (usually Solr) and aggregate searched information.
 xmlEncode ($string)
 Encode content to be included in XML files.
 jsonEncode ($string)
 Encode a string to put in a JSON value.

Data Fields

 $subjectTriples = array()
 Array of triples where the current resource is a subject.
 $objectTriples = array()
 Array of triples where the current resource is an object.
 $resultset = array()
 Resultset returned by Solr.
 $resultsetObjectProperties = array()
 Resultset of object properties returned by Solr.
 $resultsetObjectPropertiesUris = array()
 Resultset of object properties URIs returned by Solr.
 $aggregates = array()
 Aggregates of the search.
 $include_aggregates = array()
 Include aggregates to the resultset.

Static Public Attributes

static $supportedSerializations
 Supported serialization mime types by this Web service.
static $data_ini = "/data/"
 data.ini file folder
static $network_ini = "/usr/share/structwsf/"
 network.ini file folder

Protected Member Functions

 validateQuery ()
 Validate a query to this web service.

Protected Attributes

 $db_username = ""
 Database user name.
 $db_password = ""
 Database password.
 $db_dsn = ""
 Database DSN connection.
 $db_host = "localhost"
 Database host.
 $dtdBaseURL = ""
 DTD URL of the web service.
 $wsf_graph = ""
 The graph where the Web Services Framework description has been indexed.
 $wsf_base_url = ""
 Base URL of the WSF.
 $wsf_base_path = ""
 Local server path of the WSF files.
 $wsf_local_ip = ""
 Local server path of the WSF files.
 $wsf_solr_core = ""
 The core to use for Solr; "" for no core.
 $ontologies_files_folder = ""
 Path to the ontologies description files (in RDFS and OWL).
 $solr_host = "localhost"
 Hostname where to send queries to the Solr instance.
 $ontological_structure_folder = ""
 Path to the structWSF ontological structure.
 $track_create = FALSE
 Enable the tracking of records changes from the Crud Create web service endpoint.
 $track_update = FALSE
 Enable the tracking of records changes from the Crud Update web service endpoint.
 $track_delete = FALSE
 Enable the tracking of records changes from the Crud Delete web service endpoint.
 $tracking_endpoint = ""
 Specifies a specific WSF tracking web service endpoint URL to access the tracking endpoint. This is useful to put all the record changes tracking on a different, dedicated purposes, WSF server. If this parameter is commented, we will use the wsf_base_url to access the tracking endpoints. If it is uncommented, then we will use the endpoint specified by this parameter.
 $triplestore_port = "8890"
 Port number where the triple store server is reachable.
 $solr_port = "8983"
 Port number where the Solr store server is reachable.
 $log_table = "SD.WSF.ws_queries_log"
 Name of the logging table on the Virtuoso instance.
 $solr_auto_commit = FALSE
 Auto commit handled by the Solr data management systems. If this parameter is true, then this means Solr will handle the commit operation by itself. If it is false, then the web services will trigger the commit operations. Usually, Auto-commit should be handled by Solr when the size of the dataset is too big, otherwise operation such as delete could take much time.
 $fields_index_folder = "/tmp/"
 This is the folder there the file of the index where all the fields defined in Solr are indexed. You have to make sure that the web server has write access to this folder. This folder path has to end with a slash "/".
 $uri
 The URI of the Authentication Registrar web service.
 $title
 The Title of the Authentication Registrar web service.
 $crud_usage
 The CRUD usage of the Authentication Registrar web service.
 $endpoint
 The endpoint of the Authentication Registrar web service.
 $owlapiNbSessions
 Number of sessions (threads) to use in parallel.
 $owlapiBridgeURI
 URL where the Java Bridge can be accessed from this server.
 $geoEnabled = FALSE

Private Member Functions

 getNamespace ($uri)
 Get the namespace of a URI.

Private Attributes

 $conneg
 Conneg object that manage the content negotiation capabilities of the web service.
 $dtdURL
 URL where the DTD of the XML document can be located on the Web.
 $attributes = ""
 List of attributes to filter.
 $types = ""
 List of types to filter.
 $datasets = ""
 List of datasets to search.
 $items = ""
 Number of items to return per page.
 $page = ""
 Page number to return.
 $inference = ""
 Enabling the inference engine.
 $requester_ip = ""
 IP of the requester.
 $registered_ip = ""
 Requested IP.
 $query = ""
 Global query filtering parameter.
 $namespaces
 Namespaces/Prefixes binding.
 $distanceFilter
 $rangeFilter
 $errorMessenger
 Error messages of this web service.

Detailed Description

Search Web Service. It searches datasets by using three filtering properties: (1) datasets, (2) types and (3) attributes, (4) attribute/value.


Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 27 of file Search.php.


Constructor & Destructor Documentation

__construct ( query,
types,
attributes,
datasets,
items,
page,
inference,
include_aggregates,
registered_ip,
requester_ip,
distanceFilter = "",
rangeFilter = "" 
)

Constructor.

Initialize the Search webservice endpoint

Parameters:
[in] $query Global query filtering parameter
[in] $types List of filtering types URIs separated by ";"
[in] $attributes List of filtering attributes (property) of (encoded) URIs separated by ";". Additionally, the URI can end with a (un-encoded) double-colon "::". What follows this colon is a possible value restriction to be applied, as a filter to this attribute. The lucene query syntax can be used for that filtering value. The value also has to be encoded. An example of this "attribute" parameter is: "http%3A%2F%2Fsome-attribute-uri::some%2Bfiltering%2Bvalue"
[in] $datasets List of filtering datasets URIs separated by ";"
[in] $items Number of items returned by resultset
[in] $page Starting item number of the returned resultset
[in] $inference Enabling inference on types
[in] $include_aggregates Including aggregates with returned resultsets
[in] $registered_ip Target IP address registered in the WSF
[in] $requester_ip IP address of the requester
[in] $distanceFilter The distance filter is a series of parameter that are used to filter records of the dataset according to the distance they are located from a given lat;long point. The values are seperated by a semi-column ";". The format is as follow: "lat;long;distance;distanceType". The distanceType can have two values "0" or "1": "0" means that the distance specified is in kilometers and "1" means that the distance specified is in miles. An example is: "-98.45;10.4324;5;0", which means getting all the results that are at maximum 5 kilometers from the lat/long position.
[in] $rangeFilter The range filter is a series of parameter that are used to filter records of the dataset according to a rectangle bounds they are located in given their lat;long position. The values are seperated by a semi-column ";". The format is as follow: "top-left-lat;top-left-long;bottom-right-lat;bottom-right-long".


Returns:
returns NULL
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 183 of file Search.php.

References $attributes, $datasets, $distanceFilter, $include_aggregates, $inference, $items, $page, $query, $rangeFilter, $registered_ip, $requester_ip, $types, and WebService::__construct().

Here is the call graph for this function:

__destruct (  ) 

Reimplemented from WebService.

Definition at line 241 of file Search.php.

Referenced by ws_respond().


Member Function Documentation

getNamespace ( uri  )  [private]

Get the namespace of a URI.

Parameters:
[in] $uri Uri of the resource from which we want the namespace


Returns:
returns the extracted namespace
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 1006 of file Search.php.

References WebService::$uri.

Referenced by pipeline_serialize().

injectDoctype ( xmlDoc  ) 

Inject the DOCType in a XML document.


Parameters:
[in] $xmlDoc The XML document where to inject the doctype
Returns:
a XML document with a doctype
Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 568 of file Search.php.

Referenced by pipeline_getResultset().

jsonEncode ( string  )  [inherited]

Encode a string to put in a JSON value.

Parameters:
[in] $string The string to escape


Returns:
returns the escaped string
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 591 of file WebService.php.

Referenced by Sparql::pipeline_serialize(), pipeline_serialize(), DatasetRead::pipeline_serialize(), CrudRead::pipeline_serialize(), Browse::pipeline_serialize(), and AuthLister::pipeline_serialize().

pipeline_conneg ( accept,
accept_charset,
accept_encoding,
accept_language 
)

Do content negotiation as an internal, pipelined, Web Service that is part of a Compound Web Service.


Parameters:
[in] $accept Accepted mime types (HTTP header)
[in] $accept_charset Accepted charsets (HTTP header)
[in] $accept_encoding Accepted encodings (HTTP header)
[in] $accept_language Accepted languages (HTTP header)
Returns:
returns NULL
Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 638 of file Search.php.

References ws_conneg().

Here is the call graph for this function:

pipeline_getError (  ) 

Returns the error structure.


Returns:
returns the error structure
Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 286 of file Search.php.

pipeline_getResponseHeaderStatus (  ) 

Returns the response HTTP header status.


Returns:
returns the response HTTP header status
Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 651 of file Search.php.

pipeline_getResponseHeaderStatusMsg (  ) 

Returns the response HTTP header status message.


Returns:
returns the response HTTP header status message
Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 663 of file Search.php.

pipeline_getResponseHeaderStatusMsgExt (  ) 

Returns the response HTTP header status message extension.


Returns:
returns the response HTTP header status message extension
Note:
The extension of a HTTP status message is
Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 677 of file Search.php.

pipeline_getResultset (  ) 

Create a resultset in a pipelined mode based on the processed information by the Web service.


Returns:
a resultset XML document
Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 299 of file Search.php.

References Namespaces::$iron, $resultset, $type, WebService::$uri, and injectDoctype().

Referenced by pipeline_serialize(), pipeline_serialize_reification(), and ws_serialize().

Here is the call graph for this function:

pipeline_serialize (  ) 

Serialize the web service answer.


Returns:
returns the serialized content
Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 689 of file Search.php.

References getNamespace(), WebService::jsonEncode(), pipeline_getResultset(), and WebService::xmlEncode().

Referenced by ws_serialize().

Here is the call graph for this function:

pipeline_serialize_reification (  ) 

Non implemented method (only defined).


Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 1056 of file Search.php.

References pipeline_getResultset(), and WebService::xmlEncode().

Referenced by ws_serialize().

Here is the call graph for this function:

process (  ) 

Send the search query to the system supporting this web service (usually Solr) and aggregate searched information.


Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 1239 of file Search.php.

References $attributes, $dataset, $datasets, Namespaces::$geo, Namespaces::$geonames, Namespaces::$iron, Namespaces::$rdf, $resultset, Namespaces::$sco, $type, $types, WebService::$uri, and $ws_al.

validateQuery (  )  [protected]

Validate a query to this web service.


Returns:
TRUE if valid; FALSE otherwise
Note:
This function is not used by the authentication validator web service
Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 255 of file Search.php.

Referenced by ws_conneg().

ws_conneg ( accept,
accept_charset,
accept_encoding,
accept_language 
)

Do content negotiation as an external Web Service.


Parameters:
[in] $accept Accepted mime types (HTTP header)
[in] $accept_charset Accepted charsets (HTTP header)
[in] $accept_encoding Accepted encodings (HTTP header)
[in] $accept_language Accepted languages (HTTP header)
Returns:
returns NULL
Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 596 of file Search.php.

References $supportedSerializations, and validateQuery().

Referenced by pipeline_conneg().

Here is the call graph for this function:

ws_respond ( content  ) 

Sends the HTTP response to the requester.


Parameters:
[in] $content The content (body) of the response.
Returns:
NULL
Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 1213 of file Search.php.

References __destruct().

Here is the call graph for this function:

ws_serialize (  ) 

Serialize the web service answer.


Returns:
returns the serialized content
Author:
Frederick Giasson, Structured Dynamics LLC.




Reimplemented from WebService.

Definition at line 1157 of file Search.php.

References pipeline_getResultset(), pipeline_serialize(), and pipeline_serialize_reification().

Here is the call graph for this function:


Field Documentation

$aggregates = array()

Aggregates of the search.

Definition at line 105 of file Search.php.

$attributes = "" [private]

List of attributes to filter.

Definition at line 36 of file Search.php.

Referenced by __construct(), and process().

$conneg [private]

Conneg object that manage the content negotiation capabilities of the web service.

Definition at line 30 of file Search.php.

$crud_usage [protected, inherited]

The CRUD usage of the Authentication Registrar web service.

Definition at line 122 of file WebService.php.

Referenced by AuthRegistrarWs::ws_conneg().

$data_ini = "/data/" [static, inherited]

data.ini file folder

Definition at line 32 of file WebService.php.

Referenced by WebService::__construct(), and Logger::__construct().

$datasets = "" [private]

List of datasets to search.

Definition at line 42 of file Search.php.

Referenced by __construct(), and process().

$db_dsn = "" [protected, inherited]

Database DSN connection.

Definition at line 44 of file WebService.php.

$db_host = "localhost" [protected, inherited]

Database host.

Definition at line 47 of file WebService.php.

$db_password = "" [protected, inherited]

Database password.

Definition at line 41 of file WebService.php.

$db_username = "" [protected, inherited]

Database user name.

Definition at line 38 of file WebService.php.

$distanceFilter [private]

Definition at line 79 of file Search.php.

Referenced by __construct().

$dtdBaseURL = "" [protected, inherited]

DTD URL of the web service.

Definition at line 50 of file WebService.php.

$dtdURL [private]

URL where the DTD of the XML document can be located on the Web.

Definition at line 33 of file Search.php.

$endpoint [protected, inherited]

The endpoint of the Authentication Registrar web service.

Definition at line 125 of file WebService.php.

Referenced by CrudUpdate::process(), CrudDelete::process(), and CrudCreate::process().

$errorMessenger [private]
Initial value:
    '{
                        "ws": "/ws/search/",
                        "_200": {
                          "id": "WS-SEARCH-200",
                          "level": "Warning",                          
                          "name": "Invalid number of items requested",
                          "description": "The number of items returned per request has to be greater than 0 and lesser than 128"
                        },
                        "_300": {
                          "id": "WS-SEARCH-300",
                          "level": "Warning",
                          "name": "No datasets accessible by that user",
                          "description": "No datasets are accessible to that user"
                        },
                        "_301": {
                          "id": "WS-SEARCH-301",
                          "level": "Warning",
                          "name": "Not geo-enabled",
                          "description": "The Search web service endpoint is not geo-enabled. Please modify your query such that it does not use any geo feature such as the distance_filter and the range_filter parameters."
                        }  
                        
                      }'

Error messages of this web service.

Definition at line 116 of file Search.php.

$fields_index_folder = "/tmp/" [protected, inherited]

This is the folder there the file of the index where all the fields defined in Solr are indexed. You have to make sure that the web server has write access to this folder. This folder path has to end with a slash "/".

Definition at line 113 of file WebService.php.

$geoEnabled = FALSE [protected, inherited]

Definition at line 133 of file WebService.php.

$include_aggregates = array()

Include aggregates to the resultset.

Definition at line 108 of file Search.php.

Referenced by __construct().

$inference = "" [private]

Enabling the inference engine.

Definition at line 51 of file Search.php.

Referenced by __construct().

$items = "" [private]

Number of items to return per page.

Definition at line 45 of file Search.php.

Referenced by __construct().

$log_table = "SD.WSF.ws_queries_log" [protected, inherited]

Name of the logging table on the Virtuoso instance.

Definition at line 100 of file WebService.php.

$namespaces [private]
Initial value:
    array ("http://www.w3.org/2002/07/owl#" => "owl", "http://www.w3.org/1999/02/22-rdf-syntax-ns#" => "rdf",
      "http://www.w3.org/2000/01/rdf-schema#" => "rdfs", "http://purl.org/ontology/wsf#" => "wsf")

Namespaces/Prefixes binding.

Definition at line 63 of file Search.php.

$network_ini = "/usr/share/structwsf/" [static, inherited]

network.ini file folder

Definition at line 35 of file WebService.php.

Referenced by WebService::__construct().

$objectTriples = array()

Array of triples where the current resource is an object.

Definition at line 93 of file Search.php.

$ontological_structure_folder = "" [protected, inherited]

Path to the structWSF ontological structure.

Definition at line 74 of file WebService.php.

$ontologies_files_folder = "" [protected, inherited]

Path to the ontologies description files (in RDFS and OWL).

Definition at line 68 of file WebService.php.

$owlapiBridgeURI [protected, inherited]

URL where the Java Bridge can be accessed from this server.

Definition at line 131 of file WebService.php.

$owlapiNbSessions [protected, inherited]

Number of sessions (threads) to use in parallel.

Definition at line 128 of file WebService.php.

$page = "" [private]

Page number to return.

Definition at line 48 of file Search.php.

Referenced by __construct().

$query = "" [private]

Global query filtering parameter.

Definition at line 60 of file Search.php.

Referenced by __construct().

$rangeFilter [private]

Definition at line 87 of file Search.php.

Referenced by __construct().

$registered_ip = "" [private]

Requested IP.

Definition at line 57 of file Search.php.

Referenced by __construct().

$requester_ip = "" [private]

IP of the requester.

Definition at line 54 of file Search.php.

Referenced by __construct().

$resultset = array()

Resultset returned by Solr.

Definition at line 96 of file Search.php.

Referenced by pipeline_getResultset(), and process().

$resultsetObjectProperties = array()

Resultset of object properties returned by Solr.

Definition at line 99 of file Search.php.

$resultsetObjectPropertiesUris = array()

Resultset of object properties URIs returned by Solr.

Definition at line 102 of file Search.php.

$solr_auto_commit = FALSE [protected, inherited]

Auto commit handled by the Solr data management systems. If this parameter is true, then this means Solr will handle the commit operation by itself. If it is false, then the web services will trigger the commit operations. Usually, Auto-commit should be handled by Solr when the size of the dataset is too big, otherwise operation such as delete could take much time.

Definition at line 107 of file WebService.php.

$solr_host = "localhost" [protected, inherited]

Hostname where to send queries to the Solr instance.

Definition at line 71 of file WebService.php.

$solr_port = "8983" [protected, inherited]

Port number where the Solr store server is reachable.

Definition at line 96 of file WebService.php.

$subjectTriples = array()

Array of triples where the current resource is a subject.

Definition at line 90 of file Search.php.

$supportedSerializations [static]
Initial value:
    array ("application/json", "application/rdf+xml", "application/rdf+n3", "application/*", "text/xml", "text/*",
      "*/*")

Supported serialization mime types by this Web service.

Definition at line 111 of file Search.php.

Referenced by ws_conneg().

$title [protected, inherited]

The Title of the Authentication Registrar web service.

Definition at line 119 of file WebService.php.

Referenced by DatasetUpdate::__construct(), and DatasetRead::process().

$track_create = FALSE [protected, inherited]

Enable the tracking of records changes from the Crud Create web service endpoint.

Definition at line 77 of file WebService.php.

$track_delete = FALSE [protected, inherited]

Enable the tracking of records changes from the Crud Delete web service endpoint.

Definition at line 83 of file WebService.php.

$track_update = FALSE [protected, inherited]

Enable the tracking of records changes from the Crud Update web service endpoint.

Definition at line 80 of file WebService.php.

$tracking_endpoint = "" [protected, inherited]

Specifies a specific WSF tracking web service endpoint URL to access the tracking endpoint. This is useful to put all the record changes tracking on a different, dedicated purposes, WSF server. If this parameter is commented, we will use the wsf_base_url to access the tracking endpoints. If it is uncommented, then we will use the endpoint specified by this parameter.

Definition at line 90 of file WebService.php.

$triplestore_port = "8890" [protected, inherited]

Port number where the triple store server is reachable.

Definition at line 93 of file WebService.php.

$types = "" [private]

List of types to filter.

Definition at line 39 of file Search.php.

Referenced by __construct(), and process().

$wsf_base_path = "" [protected, inherited]

Local server path of the WSF files.

Definition at line 59 of file WebService.php.

$wsf_base_url = "" [protected, inherited]

Base URL of the WSF.

Definition at line 56 of file WebService.php.

$wsf_graph = "" [protected, inherited]

The graph where the Web Services Framework description has been indexed.

Definition at line 53 of file WebService.php.

$wsf_local_ip = "" [protected, inherited]

Local server path of the WSF files.

Definition at line 62 of file WebService.php.

$wsf_solr_core = "" [protected, inherited]

The core to use for Solr; "" for no core.

Definition at line 65 of file WebService.php.


The documentation for this class was generated from the following file:
Copyright © 2009-2011. Structured Dynamics LLC Structured Dynamics LLC. All rights reserved.