Giter Site home page Giter Site logo

Comments (6)

dirkroorda avatar dirkroorda commented on May 23, 2024

You are correct that this is not yet possible. And also that the error message is not very helpful.

That said, the docs indicate that there are restrictions in the use of names of quantifiers:

https://annotation.github.io/text-fabric/about/searchusage.html#restrictions

But these restrictions are stated in difficult language.

A bit later the reasons why are explained: https://annotation.github.io/text-fabric/about/searchusage.html#implementation

from text-fabric.

dirkroorda avatar dirkroorda commented on May 23, 2024

It is a pity that the kind of query that you give here as an example is not supported by Text-Fabric.

It would make the query language much more expressive.
Unfortunately, I do not know at the moment how to implement that in full generality, and then the challenge is to implement it efficiently as well.

from text-fabric.

dirkroorda avatar dirkroorda commented on May 23, 2024

However, you could also remove the /with/ and /-/ from your query.
In this case you get what you want.

Indeed, there are other cases where what you point out here is a real limitation.

from text-fabric.

oliverglanz avatar oliverglanz commented on May 23, 2024

You are correct that this is not yet possible. And also that the error message is not very helpful.

That said, the docs indicate that there are restrictions in the use of names of quantifiers:

https://annotation.github.io/text-fabric/about/searchusage.html#restrictions

But these restrictions are stated in difficult language.

A bit later the reasons why are explained: https://annotation.github.io/text-fabric/about/searchusage.html#implementation

from text-fabric.

oliverglanz avatar oliverglanz commented on May 23, 2024

Ok. It seems that TF has the same limitations as MQL's "UnorderedGroup" it is also not possible to use the "AS" operator for elements within "UnorderedGroup".

And yes, I am aware that I could have written the query without /where/ - /-/ but sometimes it is necessary to use this if there are other object types involved whose relation to each other need to be defined.

from text-fabric.

dirkroorda avatar dirkroorda commented on May 23, 2024

For those cases, you could run a relaxed query and then filter out the unwanted results by a snippet of Python code, e.g.

results = [r for r in A.search(relaxedQuery) if r[3] == r[5]]

In TF queries are a way to circumvent a lot of Python programming, but it is not the exclusive way to get at your data, as in SQL or MySQL.

There is a balancing act between wrestling with the query language and hand-coding.

from text-fabric.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.