Code Monkey home page Code Monkey logo

Comments (5)

bwanders avatar bwanders commented on June 12, 2024

What you try to do is combining two sets of results: those that have no count, and those that have count > 10. This is a job for the union construct, whose sole purpose is merging two or more results into the query.

<table ?name ?count>
?name is a: MISC

union {
  {
    -- we need the next line to have '?name' within scope
    ?name is a: MISC
    minus {
      ?name Count: ?count
    }
  }
  {
    ?name Count: ?count
    ?count > 10
  }
}
</table>

from dokuwiki-strata.

bwanders avatar bwanders commented on June 12, 2024

Feel free to close this issue if that worked.

from dokuwiki-strata.

simon-r-white avatar simon-r-white commented on June 12, 2024

I see. Yeah that makes sense now... I must confess I didn't really see what the union construct was for, but now you mention that it makes sense.

I also realised a minor mistake in my example... if all three data entries are on the same page without fragment identifiers it goes a bit wrong.

As a more complete example (in case future readers are interested), the following does what I was asking for:

<data MISC #Bob>
Name: Bob Ross
Count: 3
</data>

<data MISC #Bill>
Name: Bill JJ
Count: 
</data>

<data MISC #Ben>
Name: Ben Ten
Count: 15
</data>


<table ?item ?name ?count>
union {
  {
    -- we need the next line to have '?name' within scope
    ?item is a: MISC
    ?item Name: ?name
    minus {
      ?item Count: ?count
    }
  }
  {
    ?item is a: MISC
    ?item Name: ?name
    ?item Count: ?count
    ?count > 10
  }
}
</table>

In words, table the union of two searches: (i) all items of type MISC with a Name field AND remove (aka minus) all results with a Count field defined; and (ii) all items of type MISC with a Name field and Count field > 10.

Also, after having a bit of a play, I think the following achieves the same thing:

<table ?item ?name ?count>
?item is a: MISC
?item Name: ?name
optional {
  ?item Count: ?count
}
minus {
  ?item Count: ?count2
  ?count2 <= 10
}
</table>

In words, table all items of type MISC with a Name field AND optionally a Count field AND remove (aka minus) all items with a defined Count field <= 10.

I think the above two tables are equivalent... with the difference being how we minus (aka remove) returned items.

There's a lot of power in the strata-plugin, I'm beginning to put multiple data entries on my wiki pages and using the table has a sort of indexing/contents.

from dokuwiki-strata.

bwanders avatar bwanders commented on June 12, 2024

Glad you find it useful!

I'd also like to thank you for bringing these points to github. Having a record of how someone discovers the use of the plugin will be of great help when I finally have time to update the documentation.

from dokuwiki-strata.

simon-r-white avatar simon-r-white commented on June 12, 2024

Thank you for taking the time to answer my questions.

from dokuwiki-strata.

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.