Hi:
Just would like to raise a question here regarding the usage of concept rules and relevant rule/constraint definition for event types in SPG schema and associated concept rule file, thanks.
I have a SPG schema with the following concept types and associated event types defined:
EntityB(EntityB): EntityType
properties:
....
EntityA(EntityA): EntityType
properties:
....
relations:
hasB: EntityB
TaxOfEntityBEvent(TaxOfEntityBEvent): ConceptType
hypernymPredicate: isA
EntityBEvent(EntityBEvent): EventType
properties:
subject(subject): EntityB
eventName(eventName): Text
IND#belongTo(belongTo): TaxOfEntityBEvent
TaxOfEntityAEvent(TaxOfEntityAEvent): ConceptType
hypernymPredicate: isA
relations:
CAU#leadTo(leadTo): TaxOfEntityBEvent
EntityAEvent(EntityAEvent): EventType
properties:
subject(subject): EntityA
eventName(eventName): Text
IND#belongTo(belongTo): TaxOfEntityAEvent
CAU#leadTo(leadTo): EntityBEvent
And in the associated schema/concept.rule file, I have the following definitions:
TaxOfEntityAEvent/A_down:TaxOfEntityBEvent/B_down
rule: [[
Define (s:TaxOfEntityAEvent/A_down)-[p:leadTo]->(o:TaxOfEntityBEvent/B_down) {
Structure {
(s)-[:subject]->(n1:EntityA)-[:hasB]->(n2:EntityB)<-[:subject]-(o)
}
Constraint {}
Action {
downEvent = createNodeInstance(
type=EntityBEvent,
value={
subject=tp.id
}
)
createEdgeInstance(
src=s,
dst=downEvent,
type=leadTo,
value={}
)
}
}
]]
And in the builder directory I have the associated instance data for EntityA, EntityB, TaxOfEntityAEvent, TaxOfEntityBEvent, and EntityAEvent. I left instance data for EntityBEvent as empty, as I'm expecting the concept rule for 'leadTo' above would automatically create a graph node as 'EntityBEvent' and the edge linking it to graph node 'EntityAEvent', with the values set as configured in the Action field.
In reality, after importing the instance data into Graph DB using the indexer python script, the ConceptType graph nodes TaxOfEntityAEvent, TaxOfEntityBEvent, the EntityType nodes EntityA, EntityB, and the EventType EntityAEvent have been successfully created in the graph, but there is no graph node 'EntityBEvent' created, and no edge linked to graph node 'EntityAEvent' as expected. Querying the 'leadTo' relation with DSL also returns empty results.
I was wondering if there is something I did wrong during the definition, and was curious about how exactly the rules and constraints (not just in concept.rule, but also rules/constraints defined directly in the schema) work in general, are they taking effect on builder level or on query level? i.e., the rules / constraints would be validated during the process of indexing data to graph DB, or only on querying the graph data after that?
Any feedback would be appreciated, thanks.
Hi:
Just would like to raise a question here regarding the usage of concept rules and relevant rule/constraint definition for event types in SPG schema and associated concept rule file, thanks.
I have a SPG schema with the following concept types and associated event types defined:
EntityB(EntityB): EntityType
properties:
....
EntityA(EntityA): EntityType
properties:
....
relations:
hasB: EntityB
TaxOfEntityBEvent(TaxOfEntityBEvent): ConceptType
hypernymPredicate: isA
EntityBEvent(EntityBEvent): EventType
properties:
subject(subject): EntityB
eventName(eventName): Text
IND#belongTo(belongTo): TaxOfEntityBEvent
TaxOfEntityAEvent(TaxOfEntityAEvent): ConceptType
hypernymPredicate: isA
relations:
CAU#leadTo(leadTo): TaxOfEntityBEvent
EntityAEvent(EntityAEvent): EventType
properties:
subject(subject): EntityA
eventName(eventName): Text
IND#belongTo(belongTo): TaxOfEntityAEvent
CAU#leadTo(leadTo): EntityBEvent
And in the associated schema/concept.rule file, I have the following definitions:
TaxOfEntityAEvent/A_down:TaxOfEntityBEvent/B_downrule: [[
Define (s:
TaxOfEntityAEvent/A_down)-[p:leadTo]->(o:TaxOfEntityBEvent/B_down) {Structure {
(s)-[:subject]->(n1:EntityA)-[:hasB]->(n2:EntityB)<-[:subject]-(o)
}
Constraint {}
Action {
downEvent = createNodeInstance(
type=EntityBEvent,
value={
subject=tp.id
}
)
createEdgeInstance(
src=s,
dst=downEvent,
type=leadTo,
value={}
)
}
}
]]
And in the builder directory I have the associated instance data for EntityA, EntityB, TaxOfEntityAEvent, TaxOfEntityBEvent, and EntityAEvent. I left instance data for EntityBEvent as empty, as I'm expecting the concept rule for 'leadTo' above would automatically create a graph node as 'EntityBEvent' and the edge linking it to graph node 'EntityAEvent', with the values set as configured in the Action field.
In reality, after importing the instance data into Graph DB using the indexer python script, the ConceptType graph nodes TaxOfEntityAEvent, TaxOfEntityBEvent, the EntityType nodes EntityA, EntityB, and the EventType EntityAEvent have been successfully created in the graph, but there is no graph node 'EntityBEvent' created, and no edge linked to graph node 'EntityAEvent' as expected. Querying the 'leadTo' relation with DSL also returns empty results.
I was wondering if there is something I did wrong during the definition, and was curious about how exactly the rules and constraints (not just in concept.rule, but also rules/constraints defined directly in the schema) work in general, are they taking effect on builder level or on query level? i.e., the rules / constraints would be validated during the process of indexing data to graph DB, or only on querying the graph data after that?
Any feedback would be appreciated, thanks.