Open bitmage opened 6 years ago
Hmm. It's been a while since i looked at this code base (although it's being used). I'll try to have a look this week.
Sorry it's been so long getting back to you @bitmage
I believe the code doesn't cover the case you are describing, although it would be very useful.
The only current support is for testing @id, @type (?) and @index values. General find-by-attribute functionality isn't included. Use cases I have seen usually involve doing a .queryAll
to collect @type=author
nodes, and then a plain-old javascript .filter
or .find
to pick out the one with the required attributes.
I'm considering a major overhaul of the library, in combination with a server-side version in C#, so I'm not sure whether to update the library in its current form with this functionality, or just add it to the feature list for the next version. Thoughts?
The document I'm querying is Example 2 from http://schema.org/Book. Here's a relevant snippet:
Here is my query:
This returns null, whereas I expect it to return the author's node.
Am I misunderstanding how the
[@attribute=value]
code is supposed to work? I'd like to be able to query on matching values within the document, not just on document structure. Is this supported?Internally, I see your extractStep function is calling
expand
onstep.value
because it doesn't match thenonExpandableValuePropNamePattern
. We end up with the valuehttp://schema.org/Return of the King
.If I comment out the call to
expand
the query still fails to match, so there's something else going on as well.