Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3ade3a5
fix : invalidating attributes after the given startTime and endTime p…
yasandu0505 Mar 25, 2026
2e5a34a
fix : fix handling zero time values and make it accepts "" vlaues
yasandu0505 Mar 25, 2026
2485263
fix: fixing time parse issue
yasandu0505 Mar 27, 2026
310f89e
fix : update the test results comparison
yasandu0505 Mar 30, 2026
4abf2ec
fix : fallback when operation changes.
yasandu0505 Mar 31, 2026
d386013
test : adding e2e tests
yasandu0505 Mar 31, 2026
90d23f7
test : adding read tests e2e
yasandu0505 Mar 31, 2026
9374b3e
review : resolve review comments
yasandu0505 Apr 9, 2026
16b547a
fix : fixing and tuning the test cases
yasandu0505 Apr 9, 2026
b91e0be
fix : fixing test coverage
yasandu0505 Apr 9, 2026
0923ff2
test : adding read layer testing
yasandu0505 Apr 9, 2026
c7670a3
fix : fixing a warning
yasandu0505 Apr 9, 2026
2499402
review : resolving zaeema's review comments
yasandu0505 Apr 16, 2026
430a762
Trigger CI
yasandu0505 Apr 16, 2026
a23ca7f
Trigger CI
yasandu0505 Apr 16, 2026
3f3a232
test : test commit on mongodb-choreo EOL issue
yasandu0505 Apr 16, 2026
9a984db
restoring the same dockerfile
yasandu0505 Apr 16, 2026
a14a8be
chore: trigger CI
yasandu0505 Apr 20, 2026
8a5da95
revert : revert and auto generated file
yasandu0505 Apr 22, 2026
156be66
fix : fixing typo
yasandu0505 Apr 22, 2026
92eed42
review : resolving review comments by zaeema
yasandu0505 Apr 22, 2026
baa77a8
fix : minor fix
yasandu0505 Apr 24, 2026
9fc79d8
fix : fix minor test case assertions issue
yasandu0505 Apr 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 41 additions & 3 deletions opengin/core-api/engine/attribute_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,44 @@ func (p *EntityAttributeProcessor) ProcessEntityAttributes(ctx context.Context,
// Create or update graph metadata BEFORE processing the attribute
// NOTE: for the attribute the timestamp is always the value carried at the attribute level
// not the entity level. The entity level timestamp is used for the entity itself.
attributeStartTime, _ := time.Parse(time.RFC3339, value.StartTime)
if err := p.handleAttributeLookUp(ctx, entity.Id, attrName, storageType, operation, attributeStartTime); err != nil {

// start time is required to create the attribute
if operation != "read" && value.StartTime == "" {
attributeResults[attrName] = &Result{
Success: false,
Error: fmt.Errorf("StartTime is required for attribute: %s", attrName),
}
continue
}
var attributeStartTime time.Time

if value.StartTime != "" {
attributeStartTime, err = time.Parse(time.RFC3339, value.StartTime)
if err != nil {
attributeResults[attrName] = &Result{
Success: false,
Error: fmt.Errorf("invalid StartTime format for attribute %s: %v", attrName, err),
}
continue
}
}

var attributeEndTime *time.Time

if value.EndTime != "" {
t, err := time.Parse(time.RFC3339, value.EndTime)
if err != nil {
attributeResults[attrName] = &Result{
Success: false,
Error: fmt.Errorf("invalid EndTime format for attribute %s: %v", attrName, err),
}
continue
}
attributeEndTime = &t
}


if err := p.handleAttributeLookUp(ctx, entity.Id, attrName, storageType, operation, attributeStartTime, attributeEndTime); err != nil {
attributeResults[attrName] = &Result{
Success: false,
Data: nil,
Expand Down Expand Up @@ -196,7 +232,7 @@ func (p *EntityAttributeProcessor) ProcessEntityAttributes(ctx context.Context,
// It creates the attribute look up metadata and the attribute node in the graph.
// It also creates the IS_ATTRIBUTE relationship between the entity and the attribute.
// It also creates the attribute metadata in the document database.
func (p *EntityAttributeProcessor) handleAttributeLookUp(ctx context.Context, entityID, attrName string, storageType storageinference.StorageType, operation string, startTime time.Time) error {
func (p *EntityAttributeProcessor) handleAttributeLookUp(ctx context.Context, entityID, attrName string, storageType storageinference.StorageType, operation string, startTime time.Time, endTime *time.Time) error {
// Generate attribute metadata
fmt.Printf("DEBUG: Handling graph metadata for attribute %s\n", attrName)
attributeID := GenerateAttributeID(entityID, attrName)
Expand All @@ -209,11 +245,13 @@ func (p *EntityAttributeProcessor) handleAttributeLookUp(ctx context.Context, en
StorageType: storageType,
StoragePath: storagePath,
Created: startTime,
Terminated: endTime,
Updated: time.Now(),
Schema: make(map[string]interface{}), // TODO: Extract schema from value
}

// Note: endTime parameter is optional and available for future use if needed
log.Printf("DEBUG: Handling graph metadata for attribute %s: [endTime: %v] [startTime: %v]", attrName, endTime, startTime)

switch operation {
case "create":
Expand Down
18 changes: 15 additions & 3 deletions opengin/core-api/engine/graph_metadata_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type AttributeMetadata struct {
StoragePath string // Path/location in the specific storage system
Created time.Time
Updated time.Time
EndTime time.Time
Terminated *time.Time
Schema map[string]interface{} // Schema information
}

Expand Down Expand Up @@ -126,6 +126,14 @@ func (g *GraphMetadataManager) createAttributeLookUpGraph(ctx context.Context, m

// create the attribute node in the graph
// stored parameters: id, kind, name, created
log.Printf("DEBUG: Creating attribute node for attribute %s: [endTime: %v] [startTime: %v]", metadata.AttributeName, metadata.Terminated, metadata.Created)

var terminated string

if metadata.Terminated != nil {
terminated = metadata.Terminated.Format(time.RFC3339)
}

attributeNode := &pb.Entity{
Id: metadata.AttributeID,
Kind: &pb.Kind{
Expand All @@ -134,7 +142,7 @@ func (g *GraphMetadataManager) createAttributeLookUpGraph(ctx context.Context, m
},
Name: commons.CreateTimeBasedValue(metadata.Created.Format(time.RFC3339), "", metadata.AttributeName),
Created: metadata.Created.Format(time.RFC3339), // contains the data object's time relation with the world
Terminated: "", // TODO: Implement invalidating a dataset for a specific time range
Terminated: terminated,
Comment thread
yasandu0505 marked this conversation as resolved.
Metadata: MakeMetadataOfAttributeMetadata(metadata),
Attributes: make(map[string]*pb.TimeBasedValueList),
Relationships: make(map[string]*pb.Relationship),
Expand Down Expand Up @@ -234,12 +242,16 @@ func MakeMetadataOfAttributeMetadata(metadata *AttributeMetadata) map[string]*an

// MakeRelationshipProto creates a Relationship protobuf object for IS_ATTRIBUTE relationship
func MakeRelationshipFromAttributeMetadata(metadata *AttributeMetadata) *pb.Relationship {
var endTime string
if metadata.Terminated != nil {
endTime = metadata.Terminated.Format(time.RFC3339)
}
return &pb.Relationship{
Id: GenerateAttributeRelationshipID(metadata.EntityID, metadata.AttributeName),
RelatedEntityId: metadata.AttributeID,
Name: IS_ATTRIBUTE_RELATIONSHIP,
StartTime: metadata.Created.Format(time.RFC3339),
EndTime: "", // TODO: Implement invalidating a relationship for a specific time range
EndTime: endTime,
Direction: IS_ATTRIBUTE_RELATIONSHIP_DIRECTION,
}
}
Expand Down
Loading
Loading