109 lines
1.9 KiB
JavaScript
109 lines
1.9 KiB
JavaScript
export class Name {
|
|
constructor(value) {
|
|
this.value = value
|
|
}
|
|
}
|
|
|
|
export class Label {
|
|
constructor(value) {
|
|
this.value = value
|
|
}
|
|
}
|
|
|
|
export class SelectedGraph {
|
|
constructor(identifier) {
|
|
this.identifier = identifier
|
|
}
|
|
}
|
|
|
|
class GraphObject {
|
|
constructor(name, label, properties = []) {
|
|
this.name = name
|
|
this.label = label
|
|
this.properties = properties
|
|
}
|
|
}
|
|
|
|
export class Node extends GraphObject {
|
|
constructor(name, label, properties) {
|
|
super(name, label, properties)
|
|
}
|
|
}
|
|
|
|
export const Direction = Object.freeze({
|
|
Left: 0,
|
|
Right: 1
|
|
})
|
|
|
|
export class Edge extends GraphObject {
|
|
constructor(name, label, properties) {
|
|
super(name, label, properties)
|
|
}
|
|
}
|
|
|
|
export class DirectedEdge extends Edge {
|
|
constructor(name, label, direction, properties) {
|
|
super(name, label, properties)
|
|
this.direction = direction
|
|
}
|
|
|
|
static fromEdge(edge, direction) {
|
|
return new DirectedEdge(edge.name, edge.label, direction, edge.properties)
|
|
}
|
|
}
|
|
|
|
export class Relationship {
|
|
constructor(left, edge, right) {
|
|
const [from, to] = edge.direction === Direction.Right ? [left, right] : [right, left]
|
|
this.from = from
|
|
this.to = to
|
|
this.edge = edge
|
|
}
|
|
}
|
|
|
|
export class ReturnValues {
|
|
constructor(...args) {
|
|
this.values = args
|
|
}
|
|
}
|
|
|
|
export class KeyValuePair {
|
|
constructor(key, value) {
|
|
this.key = key
|
|
this.value = value
|
|
}
|
|
}
|
|
|
|
export class Literal {
|
|
constructor(value) {
|
|
this.value = value
|
|
}
|
|
}
|
|
|
|
export class Identifier {
|
|
constructor(value) {
|
|
this.value = value
|
|
}
|
|
}
|
|
|
|
export class Alias {
|
|
constructor(value, alias) {
|
|
this.value = value
|
|
this.alias = alias
|
|
}
|
|
}
|
|
|
|
export class ObjectPath {
|
|
constructor(value, ...path) {
|
|
this.value = value
|
|
this.path = path
|
|
}
|
|
}
|
|
|
|
export class Query {
|
|
constructor(use, match, returnValues) {
|
|
this.use = use
|
|
this.match = match
|
|
this.returnValues = returnValues
|
|
}
|
|
}
|