Search
From DocWiki
The Search Web service is used to perform full text searches on the structured data indexed on a structWSF instance. Each search query can be applied to all, or a subset of, datasets accessible by the requester. Additionally, the requester can specify the types of things he wants to search for (example: searching for all people with the search string "Bob"). All of these full text queries comply with the Lucene querying syntax.
Developers communicate with the Search Web service using the HTTP POST method. You may request one of the following mime types: (1) text/xml, (2) application/rdf+xml, (3) application/rdf+n3 or (4) application/json. The content returned by the Web service is serialized using the mime type requested and the data returned depends on the parameters selected.
Contents |
Usage
This Web service is intended to be used by content management systems, developers or administrators to manage access to WSF (Web Service Framework) resources (users, datasets, Web services endpoints).
Web Service Endpoint Information
This section describes all the permissions you need in the WSF (Web Service Framework) to send a query to this Web service endpoint, and it describes how to access it.
To access this Web service endpoint you need the proper CRUD (Create, Read, Update and Delete) permissions on a specific graph (dataset) of the WSF. Without the proper permissions on this graph you won't be able to send any queries to the endpoint.
- Create: False
- Read: True
- Update: False
- Delete: False
As shown on the graph URI:
- URIs of the datasets to be queried
Here is the information needed to communicate with this Web service's endpoint. Descriptions of the parameters are included below.
Note: if a parameter has a default value, the requester can omit it and the default value will be used. Also, some baseline Web services may not offer other values than the default.
- POST
Possible "Accept:" HTTP header field value:
- text/xml (DTD validating the returned content)
- application/json
- application/rdf+xml
- application/rdf+n3
URI:
- http://[...]/ws/search/ ?query=param1&types=param2&attributes=param3&datasets=param4&items=param5&page=param6&inference=param7&include_aggregates=param8®istered_ip=param9
URI dynamic parameters description:
Note: All parameters have to be URL-encoded
- param1. Full text query. This query should comply with the Lucene Querying Syntax.
- param2 (default: all). List of types of the records to be searched. Each type is separated by the ";" character. an example of such a list is: "type-a;type-b;type-c" meaning: I want to search for all the records with these types .
- param3.' (default: all'). List of attributes of the records to be searched. Each attribute is separated by the ";" character. an example of such a list is: "attribute-a;attribute-b;attribute-c" meaning: I want to search for all the records with these attributes.
- param4 (default: all). List of dataset URIs to be searched. Each dataset URI is separated by the ";".
- param5. (default: 10)). The number of items to return in a single resultset
- param6. (default: 0). The offset of the resultset to return. By example, to get the item 90 to 100, this parameter should be set to 9.
- param7. (default: on).One of:
- "on": Inference is enabled
- "off": Inference is disabled
- param8.(default: off) One of:
- "true": Aggregation data included in the resultset
- "false": Aggregation data not included in the resultset
- param9.Target IP address registered in the WSF. Needed when param1 = "access_user". Otherwise this parameter as to be omitted.
Example of Returned XML Document
This is an example of the XML document returned by this Web service endpoint for a given URI. This example returns a list of datasets accessible by a given user IP.
- http://[...]/ws/search/parameters: query=rdf&types=all&datasets=http%3A%2F%2F[...]%2Fwsf%2Fdatasets%2F283%2F%3Bhttp%3A%2F%2F[...]%2Fwsf%2Fdatasets%2F160%2F&
items=10&page=0&inference=on&include_aggregates=true®istered_ip=self%3A%3A1
"Accept:" HTTP header field value:
- text/xml
Result:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE resultset PUBLIC "-//Structured Dynamics LLC//Search DTD 0.1//EN" "http://constructscs.com:8890/ws/dtd/search/search.dtd"><resultset><prefix entity="aggr" uri="http://purl.org/ontology/aggregate#"/><subject type="http://purl.org/ontology/swt#Ontology" uri="http://constructscs.com/conStruct/datasets/122/resource/mopy"><predicate type="http://purl.org/dc/terms/isPartOf"><object type="http://rdfs.org/ns/void#Dataset" uri="http://constructscs.com/wsf/datasets/122/"/></predicate><predicate type="http://usefulinc.com/ns/doap#name"><object type="rdfs:Literal">mopy</object>
</predicate><predicate type="http://usefulinc.com/ns/doap#homepage"><object type="rdfs:Literal">http://www.sourceforge.net/projects/motools</object>
</predicate><predicate type="http://usefulinc.com/ns/doap#programming-language"><object type="rdfs:Literal">Python</object>
</predicate><predicate type="http://purl.org/ontology/swt#status"><object type="rdfs:Literal">Existing</object></predicate><subject type="aggr:Aggregate" uri="http://constructscs.com/wsf/ws/search/aggregate/8d4746ea554cfec324b0a740fbbc9be6/6ff6595d838e72f230b1b88974705166/"><predicate type="aggr:property"><object uri="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/></predicate><predicate type="aggr:object"><object uri="http://purl.org/ontology/swt#SearchEngine"/></predicate><predicate type="aggr:count"><object type="rdfs:Literal">5</object></predicate></subject></resultset>
HTTP Status Codes
Here are the possible HTTP status (error) codes returned by this Web service endpoint.
On error code and the specific error, a different message description can be issued (meaning a different error has been returned).
- Code:200
- Message:OK
- Code:400
- Message:Bad Request
- Message description:No query specified for this request
- Message description:The number of items returned per request has to be greater than 0 and lesser than 128
- Message description:No dataset accessible by that user
- Message description:No requester IP available
- Message description: No Web service URI available
- Message description:Target Web service XYZ not registered to this Web Services Framework
- Message description:No access defined for this requester IP XYZ, dataset (XYZ) and Web service (XYZ)
- Message description:The target Web service (XYZ) needs create access and the requested user (XYZ) doesn't have this access for that dataset (XYZ)
- Message description:The target Web service (XYZ) needs read access and the requested user (XYZ) doesn't have this access for that dataset (XYZ)
- Message description:The target Web service (XYZ) needs update access and the requested user (XYZ) doesn't have this access for that dataset (XYZ)
- Message description:The target Web service (XYZ) needs delete access and the requested user (XYZ) doesn't have this access for that dataset (XYZ)
- Code:406
- Message:Not Acceptable
- Message description:Unacceptable mime type requested
- Code:500
- Message:Internal Error