Skip to content

Latest commit

 

History

History
102 lines (74 loc) · 5.46 KB

File metadata and controls

102 lines (74 loc) · 5.46 KB

Function: Query for Infotons Using Field Conditions


Go to:      Root TOC      Topic TOC      Previous Topic     Next Topic


Description

This function enables you to search for infotons whose field values meet specific conditions. You can define one or more conditions on field values, and you can specify different types of comparison operators (e.g. exact or partial string match, numeric inequality...). The search returns only those infotons that reside under the path you specify, which meet the field value conditions.

For example, you can search for all organizations under the permid.org branch of CM-Well which are located in New York state, by defining a query with the permid.org path and a condition on the value of the organizationStateProvince field.

Note: By default, search queries are not recursive. So, for example, if you supply a search path of <CMWellHost>/<SomePath>, the query returns only infotons that are directly under SomePath. If they have other descendant infotons, these are not returned unless explicitly requested. To make a search operation recursive, use the recursive flag, as follows:

<cm-well-host>/permid.org?op=search&qp=CommonName.mdaas:Coca%20Cola&length=1&format=n3&recursive

Syntax

URL: <hostURL>/<PATH> REST verb: GET Mandatory parameters: op=search&qp=<fieldConditions>


Template:

<cm-well-path>?op=search&qp=<fieldConditions>&<otherParameters...>

URL example: <cm-well-host>/permid.org?op=search&qp=CommonName.mdaas:Coca%20Cola&length=1&format=n3&with-data

Curl example (REST API):

Curl -X GET <cm-well-host>/permid.org?op=search&qp=CommonName.mdaas:Coca%20Cola&length=1&format=n3&with-data

Code Example

Call

<cm-well-host>/permid.org?op=search&qp=CommonName.mdaas:Coca%20Cola&length=1&format=n3&with-data

Results

@prefix nn:<cm-well-host/meta/nn#> .
@prefix mdaas: <http://ont.com/mdaas/> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix sys:   <cm-well-host/meta/sys#> .

<http://permid.org/1-21588085919>
amdaas:Quote ;
sys:dataCenter   "dc1" ;
sys:indexTime"1463590815956"^^xsd:long ;
sys:lastModified "2016-05-18T17:00:14.565Z"^^xsd:dateTime ;
sys:parent   "/permid.org" ;
sys:path "/permid.org/1-21588085919" ;
sys:type "ObjectInfoton" ;
sys:uuid "4342745f947e9abb5c32367dd0e4689f" ;
mdaas:CommonName "COCA-COLA AM SSBA 31DEC2029 7.65CWNT" ;
mdaas:ExchangeTicker "CCLKOA" ;
mdaas:IsTradingIn"AUD" ;
mdaas:QuoteExchangeCode  "ASX" ;
mdaas:RCSAssetClass  "TRAD" ;
mdaas:RIC"CCLKOAta.AX" ;
mdaas:TRCSAssetClass "Traditional Warrants" .

[ sys:pagination  [ sys:first  <cm-well-host/permid.org?format=n3?&op=search&from=2016-05-18T17%3A00%3A14.565Z&to=2016-05-18T17%3A00%3A14.565Z&qp=CommonName.mdaas%3ACoca+Cola&length=1&offset=0> ;
sys:last   <cm-well-host/permid.org?format=n3?&op=search&from=2016-05-18T17%3A00%3A14.565Z&to=2016-05-18T17%3A00%3A14.565Z&qp=CommonName.mdaas%3ACoca+Cola&length=1&offset=11605> ;
sys:next   <cm-well-host/permid.org?format=n3?&op=search&from=2016-05-18T17%3A00%3A14.565Z&to=2016-05-18T17%3A00%3A14.565Z&qp=CommonName.mdaas%3ACoca+Cola&length=1&offset=1> ;
sys:self   <cm-well-host/permid.org?format=n3?&op=search&from=2016-05-18T17%3A00%3A14.565Z&to=2016-05-18T17%3A00%3A14.565Z&qp=CommonName.mdaas%3ACoca+Cola&length=1&offset=0> ;
sys:type   "PaginationInfo"
  ] ;
  sys:results [ sys:fromDate  "2016-05-18T17:00:14.565Z"^^xsd:dateTime ;
sys:infotons  <http://permid.org/1-21588085919> ;
sys:length"1"^^xsd:long ;
sys:offset"0"^^xsd:long ;
sys:toDate"2016-05-18T17:00:14.565Z"^^xsd:dateTime ;
sys:total "11605"^^xsd:long ;
sys:type  "SearchResults"
  ] ;
  sys:type"SearchResponse"
] .

Notes

  • If you don’t know the precise field name to search in, you can indicate that you want to search in all fields, as follows: qp=_all:Marriott%20Ownership%20Resorts. Use this option with caution as it may be expensive in terms of run-time.
  • Special characters must be escaped in the usual way for URIs. For example, spaces are escaped via %20, # characters are encoded using %23, and so on.
  • Although most RDF structures use the standard of prefix:fieldname, in CM-Well you add the field name prefix after the name itself, as follows: fieldname.prefix. For example "CommonName.mdaas".
  • You can surround a list of conditions with square brackets [...], so they can be defined as mandatory or optional as a group.
  • Note that using fuzzy matching may produce a very large number of results. When using fuzzy match, it's recommended to include other criteria in your search in order to narrow down the results set.

Related Topics

Basic Queries Advanced Queries Applying SPARQL to Query Results


Go to:      Root TOC      Topic TOC      Previous Topic     Next Topic