What's the problem with nodes supporting or not some properties? For querying you can treat all nodes as supporting all things, and the user just needs to write a query that acutually works, which is what they would need to do anyway.
Yes, if you want to make the query language reject as incorrect queries that specify a property on a node that can't have properties, it is messy. But is this really necessary? You can write faulty queries anyway. And it's not a programming language for complex systems, where it really helps to prevent mistakes early. SQL works fine with no type safety and so on.
Re:How to Use JSON Path
by PurpleRamen on Friday May 03, 2024 @11:43AM
(#40248971)
The problem is that you can't easily reuse a query with different formats, with a swallow designed language. You will still end up writing format-targeted queries, which then open the question of why you would even bother in the first place using a watered down language, instead of a format-optimized one.
Another issue is that the term "document" is also used to refer to XML or HTML.
Re:How to Use JSON Path
by PurpleRamen on Friday May 03, 2024 @03:36PM
(#40251453)
XML is for data-exchange, competing with JSON and others. So I have no problem putting it to the data-documents, even though it's more a frankenstein. But HTML is an office-document, used for freetext, nobody really should use it for data, even though sometimes it's used that way.
XML is also used, literally, for office documents (Word, Excel, etc).
Re:How to Use JSON Path
by PurpleRamen on Saturday May 04, 2024 @04:53AM
(#40256031)
So are JSON and YAML. The point is whether you have a programmatic and structured handling of a document's content, or whether it's random, where every line and word can demand for a different parser.
But one problem is, that each format has slightly different ways it works. Some have nodes which support properties, some not. This makes building a proper query-language a bit more complicated if it should not end up ugly.