forked from codefuse-ai/CodeFuse-Query
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRPC.gdl
61 lines (55 loc) · 1.69 KB
/
RPC.gdl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// script
use coref::xml::*
// select XmlElement containing "mobileService"
schema MobileServiceXmlElement extends XmlElement{}
impl MobileServiceXmlElement {
@data_constraint
pub fn __all__(db: XmlDB) -> *MobileServiceXmlElement {
for (e in XmlElement(db)) {
if (e.getElementName() = "mobileService") {
yield MobileServiceXmlElement {
id: e.id,
location_id: e.location_id,
parent_id: e.parent_id,
index_order: e.index_order
}
}
}
}
pub fn getServiceBeanValue(self) -> string {
for (a in self.getAttribute()) {
if (a.getName() = "serviceBean") {
return a.getValue()
}
}
}
}
// select XmlElement containing "sofa:extension"
schema SofaExtensionXmlElement extends XmlElement{}
impl SofaExtensionXmlElement {
@data_constraint
pub fn __all__(db: XmlDB) -> *SofaExtensionXmlElement {
for (e in XmlElement(db)) {
if (e.getName() = "sofa:extension") {
yield SofaExtensionXmlElement {
id: e.id,
location_id: e.location_id,
parent_id: e.parent_id,
index_order: e.index_order
}
}
}
}
}
fn out(value: string) -> bool {
let (db = XmlDB::load("coref_xml_src.db")) {
for (m in MobileServiceXmlElement(db), s in SofaExtensionXmlElement(db), ancestor in m.getAnAncestor()) {
if (s.key_eq(ancestor) && value = m.getServiceBeanValue()) {
return true
}
}
}
}
fn main() {
output(out())
}