mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-05-15 18:35:15 +02:00
Fixed missing URIs from ontology
This commit is contained in:
parent
828540aebc
commit
e3289243bb
1 changed files with 9 additions and 6 deletions
|
|
@ -486,22 +486,25 @@ class Processor(FlowProcessor):
|
||||||
# Check if it's an ontology class
|
# Check if it's an ontology class
|
||||||
if value in ontology_subset.classes:
|
if value in ontology_subset.classes:
|
||||||
class_def = ontology_subset.classes[value]
|
class_def = ontology_subset.classes[value]
|
||||||
if hasattr(class_def, 'uri') and class_def.uri:
|
# class_def is a dict (from cls.__dict__ in ontology_selector)
|
||||||
return class_def.uri
|
if isinstance(class_def, dict) and 'uri' in class_def and class_def['uri']:
|
||||||
|
return class_def['uri']
|
||||||
# Fallback: construct URI
|
# Fallback: construct URI
|
||||||
return f"https://trustgraph.ai/ontology/{ontology_id}#{value}"
|
return f"https://trustgraph.ai/ontology/{ontology_id}#{value}"
|
||||||
|
|
||||||
# Check if it's an ontology property
|
# Check if it's an ontology property
|
||||||
if value in ontology_subset.object_properties:
|
if value in ontology_subset.object_properties:
|
||||||
prop_def = ontology_subset.object_properties[value]
|
prop_def = ontology_subset.object_properties[value]
|
||||||
if hasattr(prop_def, 'uri') and prop_def.uri:
|
# prop_def is a dict (from prop.__dict__ in ontology_selector)
|
||||||
return prop_def.uri
|
if isinstance(prop_def, dict) and 'uri' in prop_def and prop_def['uri']:
|
||||||
|
return prop_def['uri']
|
||||||
return f"https://trustgraph.ai/ontology/{ontology_id}#{value}"
|
return f"https://trustgraph.ai/ontology/{ontology_id}#{value}"
|
||||||
|
|
||||||
if value in ontology_subset.datatype_properties:
|
if value in ontology_subset.datatype_properties:
|
||||||
prop_def = ontology_subset.datatype_properties[value]
|
prop_def = ontology_subset.datatype_properties[value]
|
||||||
if hasattr(prop_def, 'uri') and prop_def.uri:
|
# prop_def is a dict (from prop.__dict__ in ontology_selector)
|
||||||
return prop_def.uri
|
if isinstance(prop_def, dict) and 'uri' in prop_def and prop_def['uri']:
|
||||||
|
return prop_def['uri']
|
||||||
return f"https://trustgraph.ai/ontology/{ontology_id}#{value}"
|
return f"https://trustgraph.ai/ontology/{ontology_id}#{value}"
|
||||||
|
|
||||||
# Otherwise, treat as entity instance - construct unique URI
|
# Otherwise, treat as entity instance - construct unique URI
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue