GraphQuery
GraphQuery is a query language and execution engine tied to any backend service. It is back-end language independent
.
Project Address: GraphQuery
Related Projects:
- GraphQuery-PlayGround : Learn and test GraphQuery in an interactive walkthrough
- Document : Detailed documentation of GraphQuery
GraphQuery-http : Cross language solution for GraphQuery
Catalog
- Overview
- Getting Started
- Install
Overview
GraphQuery is an easy to use query language, it has built-in Xpath/CSS/Regex/JSONpath
selectors and enough built-in text processing functions
.
The most amazing thing is that you can use the minimalist GraphQuery syntax to get any data structure you want
.
Language-independent
Use GraphQuery to let you unify text parsing logic on any backend language.
You won't need to find implementations of Xpath/CSS/Regex/JSONpath selectors between different languages ??and get familiar with their syntax or explore their compatibility.
Multiple selector syntax support
You can use GraphQuery to parse any text and use your skilled selector. GraphQuery currently supports the following selectors:
Jsonpath
for parsing JSON stringsXpath
andCSS
for parsing XML/HTMLRegular expressions
for parsing any text.
You can use these selectors in any combination in GraphQuery. The rich built-in selector provides great flexibility for your parsing.
Complete function
Graphquery has some built-in text processing functions like trim
, template
, replace
. If you think these functions don't meet your needs, you can register new custom functions in the pipeline.
Clear data structure & Concise grammar
With GraphQuery, you won't need to look for parsing libraries when parsing text, nor do you need to write complex nesting and traversal. Simple and clear GraphQuery syntax gives you a clear picture of the data structure.
As you can see from the comparison chart above, the syntax of GraphQuery is so simple that even if you are in touch with it for the first time, you can still understand its meaning and get started quickly.
At the same time, GraphQuery is also very easy to integrate into your backend data system (any backend language), let's continue to look down.
Getting Started
GraphQuery consists of query language and pipelines. To guide you through each of these components, we've written an example designed to illustrate the various pieces of GraphQuery. This example is not comprehensive, but it is designed to quickly introduce the core concepts of GraphQuery. The premise of the example is that we want to use GraphQuery to query for information about library books.
1. First example
<library>
<!-- Great book. -->
<book id="b0836217462" available="true">
<isbn>0836217462</isbn>
<title lang="en">Being a Dog Is a Full-Time Job</title>
<quote>I'd dog paddle the deepest ocean.</quote>
<author id="CMS">
<?echo "go rocks"?>
<name>Charles M Schulz</name>
<born>1922-11-26</born>
<dead>2000-02-12</dead>
</author>
<character id="PP">
<name>Peppermint Patty</name>
<born>1966-08-22</born>
<qualification>b