RQLとは

, REST-. . «books», . , . - . , .. . Resource Query Language.

Resource Query Language (RQL) — , URI - . RQL , .., , , . , eq(author,) URL: author=.

RQL , , , . , , URL .

RQL


RQL , .


. MongoDB.

:

[
{ title: " ", year: 1993, series: " " },
{ title: " ", year: 1993, series: " " },
{ title: " ", year: 1995, series: " " },
{ title: "  ", year: 1995, series: " " }
]

« ». MongoDB :

db.users.find({series: " "})

RQL :

eq(series, " ")



series=" "

.

: « » 1995 .

MongoDB:

db.users.find({series: " ", year: 1995})

RQL:

eq(series, " "),eq(year, 1995)

. . , :

{ title: "  ", year: 1995, series: " ", translations: { language: "English", title: "Godsdoom" } }

translations. , .

MongoDB:

db.users.find({"translations.language": "English"})

RQL:

eq(translations.language, "English")

. .

MongoDB :

db.users.find().skip(10).limit(10)

RQL:

limit(10,10)

. .

MongoDB :

db.users.find().sort({title: 1})

RQL:

sort(+title) 


:
in (<proprty>,<array-of-values>),
.

:
in(name,(Silver,Gold))
out (<proprty>,<array-of-values>), .

:
out(name,(Platinum,Gold))
limit (<strt>,<numbr>)
(number)
(start) .

:
limit(0,2)
sort (<list of properties with + or — prefix>)( ). , , .
: + — , — — .

:
sort(+memory,-diskspace)
select (<list f attributes>), .

:
select(name,user)
values(<prperty>).

:
values(ve.name)
count().

:
in(name,(Silver,Gold))&count()
max(<prperty?>).

:
max(ve.memory)
min(<prperty?>).

:
min(ve.memory)

.

APS RQL :
like (<prperty>, <pttern>)(pattern) (property).
SQL LIKE, * %. *, -, %2A *, . . , ?, , .

:
like(firstName,Jo*)
like(firstName,*ohn)
like(firstName,*oh*)
like(firstName,Joh?)

APS :
implementing (<bas-type>)( ), .

:
implementing (http://aps-standard.org/samples/user-mgmt/offer/1.0)
composing (<drived-type>), (derived type), .

:
composing(http://aps-standard.org/samples/user-mgmt/offer/1.0)
linkedWith (<rsource ID>), , ID . APS- , . , admin/owner/referrer, , «» .

:
linkedWith(220aa29a-4ff4-460b-963d-f4a3ba093a0a)

implementing(http://aps-standard.org/types/core/user/service/1.0), linkedWith(220aa29a-4ff4-460b-963d-f4a3ba093a0a)


. .
and (<qury>,<qury>,...)&
,
and (limit(0,2),like(name,*L*))


, *L*
or (<qury>,<qury>,...)|
;
or(like(description,*free*),in(name,(Silver,Gold)))


, (description) *free*, , Silver Gold.

APS RQL :
not (<qury>)not(like(name,*free*))


, ,
— RQL *free*.



  1. and RQL- . , http://hosting.com?and(arg1,arg2,arg3) http://hosting.com?arg1,arg2,arg3.
  2. and , or. , . , implementing(<typ>),(prop1=eq=1|prop2=ge=2).


.
eq (<proprty>,<valu>)=eq=eq(aps.status,aps:ready)
aps.status=eq=aps:ready



, aps.status aps:ready.
ne (<proprty>,<valu>)=ne=ne(aps.status,aps:ready)
aps.status=ne=aps:ready



, aps.status aps:ready.
gt (<proprty>,<valu>)=gt=implementing(http://aps-standard.org/samples/user-mgmt/offer),hardware.memory=gt=1024)


(offers), hardware.memory 1024.
ge (<proprty>,<valu>)=ge=implementing(http://aps-standard.org/samples/user-mgmt/offer),hardware.memory=ge=1024)


(offers), hardware.memory 1024.
lt (<proprty>,<valu>)=lt=implementing(http://aps-standard.org/samples/user-mgmt/offer),hardware.CPU.number=lt=16)


(offers), hardware.CPU.number 16.
le (<proprty>,<valu>)=le=implementing(http://aps-standard.org/samples/user-mgmt/offer),hardware.CPU.number=le=16)


(offers), hardware.CPU.number 16.

.


:


- — , null, true, false . .
-
null(), nullname=eq=null()
true()
false()
, true falsedisabled=eq=false()
empty(), ( null, )addressPostal.extendedAddress=eq=empty()


RQL .

JavaScript , RQL- .

RQL JavaScript npmjs: https://www.npmjs.com/package/rql

npm: https://www.npmjs.com/package/aps-rql


Source: https://habr.com/ru/post/J331774/


All Articles