goofballLogic / ld-query

Querying JSON-LD
MIT License
20 stars 6 forks source link

Add child combinator #14

Closed gareth-robinson closed 8 years ago

gareth-robinson commented 8 years ago

I've implemented child combinators in this version. I've also undone my previous refactor and returned to a solution that is more similar to your original implementation. Namely

[
  { path: "http://www.example.org#grabThis" },
  { direct: true },
  { path: "http://www.example.org#type", @id: [ "http://www.example.org#type4" ] },
  { path: "#document" }
]

There are additional scenarios in selection-by-direct-child.feature to cover this. Note that if you want to select a direct child of the current node that you can do that without specifying anything on the left of the >. See the first two scenarios in the feature file for clarity.

gareth-robinson commented 8 years ago

Also, the third scenario in the selection-by-direct-child.feature is why I changed the creation of the steps and paths to be inverted, to allow right-to-left matching.

gareth-robinson commented 8 years ago

I'm signed up now in npm as gareth-robinson This is for the "Precedence of result from 'query'" issue: https://github.com/goofballLogic/ld-query/issues/13