Is there an XML metalanguage for expressing complex searches?

over the past few years, many of our internal APIs to modify and search our database have become increasingly confused with the specific needs and logic of the front-end applications that they use. To counter this trend, we decided to gradually move these APIs to web services with stable and well-defined interfaces. Another reason for this step is that the APIs were originally designed for traditional websites, while now they are increasingly used by AJAX applications, iPhone applications, external clients, etc.

In developing the details of this process, we realized that one of the main functions that we plan to provide is quite complex searches using various types of resources, such as people, documents, and locations.

Now, it’s obvious that the details of the search are largely dependent on the search space. However, there are many meta concepts that are universal. For example, logical operators connecting search predicates and hierarchical structure (curly braces) and priority rules for these operations; query range for numeric values, regular expression matching for strings, etc. Given these concepts, XML immediately comes to mind as an adequate representation for the request (as well as DSL, but I think that in our case it is too many weapons).

So my question is this: is there an XML metalanguage on which we can base our own domain-specific dialect to express such queries? Or are there other possibilities that still have not crossed our thoughts?

+3
source share
2 answers

The following scheme is widely used in the GIS world:

Here is an example:

  <ogc:Filter xmlns:gml="http://www.opengis.net/gml">
    <ogc:And>
      <ogc:PropertyIsGreaterThan>
        <ogc:PropertyName>isoap:CreationDate</ogc:PropertyName>
        <ogc:Literal>2007-07-31</ogc:Literal>
      </ogc:PropertyIsGreaterThan>
      <ogc:Or>
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>isoap:Type</ogc:PropertyName>
          <ogc:Literal>service</ogc:Literal>
        </ogc:PropertyIsEqualTo>
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>isoap:Type</ogc:PropertyName>
          <ogc:Literal>application</ogc:Literal>
        </ogc:PropertyIsEqualTo>
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>isoap:Type</ogc:PropertyName>
          <ogc:Literal>dataset</ogc:Literal>
        </ogc:PropertyIsEqualTo>
      </ogc:Or>
    </ogc:And>
  </ogc:Filter>

This can be handled in relational databases, as well as in database-oriented documents, or with full-text indexing, such as Lucene.

+1
source

XQuery, .., XML ( XML, XML).

+1

Source: https://habr.com/ru/post/1776677/


All Articles