Building a Hybrid �Knowledge Graph System
Giuseppe Futia �CSI Piemonte - Consortium for Information Systems (Italy)
Integrating LPG, RDF, and LLMs for Advanced Analytics
Analysis�Rules generation, validation reporting, contextual explainability
Our journey
Application
Regulatory compliance, conflict of interest, �360-degree view
Building
From business understanding to knowledge graph generation
https://github.com/giuseppefutia/klab?tab=readme-ov-file#-building-a-hybrid-knowledge-graph-system
“Don’t fall in love with the idea [or the technology],
Fall in love with the problem.”
Public
Procurement
Officer/Manager
Public
Procurement
Officer/Manager
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Public
Procurement
Officer/Manager
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Public
Procurement
Officer/Manager
360-Degree View �Track all activities tied to a business owner.
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
⚠️
From Business Understanding to�Knowledge Graph Generation (LPG)
16
Procurement
Officer/Manager
Contracts
360-Degree View �Track all activities tied to a business owner.
CSV files released by the City of Chicago
Business Understanding
Data Understanding
Graph Model Definition
Knowledge Graph Generation
Mapping Data to Nodes, Relationships and Properties
Integrating information from different sources into the KG unified representation
The resulting KG can support for starting specific investigations
Licenses
Owners
Employees
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
Knowledge Graph Generation
Procurement
Officer/Manager
360-Degree View �Track all activities tied to a business owner.
Business Understanding
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
Building Understanding
18
Procurement
Officer/Manager
Contracts
360-Degree View �Track all activities tied to a business owner.
CSV files released by the City of Chicago
Business Understanding
Data Understanding
Licenses
Owners
Employees
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
Data Understanding
19
Procurement
Officer/Manager
Contracts
360-Degree View �Track all activities tied to a business owner.
CSV files released by the City of Chicago
Business Understanding
Data Understanding
Licenses
Owners
Employees
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
Connections Between the Datasets
No shared ids between owners and employees
20
Procurement
Officer/Manager
Contracts
360-Degree View �Track all activities tied to a business owner.
CSV files released by the City of Chicago
Business Understanding
Data Understanding
Licenses
Owners
Employees
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
Connections Between the Datasets
No shared ids between owners and employees
No shared ids between ORGs in licenses and contracts
21
Procurement
Officer/Manager
Contracts
360-Degree View �Track all activities tied to a business owner.
CSV files released by the City of Chicago
Business Understanding
Data Understanding
Licenses
Owners
Employees
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
Connections Between the Datasets
No shared ids between owners and employees
No shared ids between ORGs in licenses and contracts
No shared ids between departments connected to employees and contracts
22
Procurement
Officer/Manager
Contracts
360-Degree View �Track all activities tied to a business owner.
CSV files released by the City of Chicago
Business Understanding
Data Understanding
Licenses
Owners
Employees
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
Connections Between the Datasets
No shared ids between owners and employees
No shared ids between ORGs in licenses and contracts
No shared ids between departments connected to employees and contracts
Shared ORG ids in owners and licenses
23
Procurement
Officer/Manager
Contracts
360-Degree View �Track all activities tied to a business owner.
CSV files released by the City of Chicago
Business Understanding
Data Understanding
Graph Model Definition
Mapping Data to Nodes, Relationships and Properties
Integrating information from different sources into the KG unified representation
Licenses
Owners
Employees
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
Graph Model Definition
Licenses
Contracts
Owners
Employees
Licenses
Contracts
License Record
License Type
Contract Record
Contract
Procur�Type
Contract�Type
HAS_LICENSE_TYPE
INCLUDED_IN_�CONTRACT
HAS_PROCUR_TYPE
HAS_CONTR_ TYPE
Owners
Employees
Person Record
Licenses
Contracts
Owners
Person
License Record
License Type
Contract Record
Contract
Procur�Type
Contract�Type
Dept
IS_SIMILAR_TO
RECORD_�RESOLVED_TO
HAS_LICENSE_TYPE
INCLUDED_IN_�CONTRACT
HAS_PROCUR_TYPE
HAS_CONTR_ TYPE
ASSIGNS_�CONTRACT
IS_SIMILAR_TO
WORKS_FOR_�DEPARTMENT
Employees
Person Record
Licenses
Contracts
Owners
Person
License Record
License Type
Address
Contract Record
Org
Contract
Procur�Type
Contract�Type
Dept
IS_SIMILAR_TO
RECORD_�RESOLVED_TO
Org�Group
WORKS_FOR_�ORG
HAS_LICENSE_TYPE
HAS_�ADDRESS
ORG_HAS_�LICENSE
IS_SIMILAR_TO
BELONGS_TO_ORG_GROUP
HAS_VENDOR
INCLUDED_IN_�CONTRACT
HAS_PROCUR_TYPE
HAS_CONTR_ TYPE
ASSIGNS_�CONTRACT
IS_SIMILAR_TO
WORKS_FOR_�DEPARTMENT
Employees
Person Record
Licenses
Contracts
Owners
Person
License Record
License Type
Address
Contract Record
Org
Contract
Procur�Type
Contract�Type
Dept
IS_SIMILAR_TO
RECORD_�RESOLVED_TO
Org�Group
WORKS_FOR_�ORG
HAS_LICENSE_TYPE
HAS_�ADDRESS
ORG_HAS_�LICENSE
IS_SIMILAR_TO
BELONGS_TO_ORG_GROUP
HAS_VENDOR
INCLUDED_IN_�CONTRACT
HAS_PROCUR_TYPE
HAS_CONTR_ TYPE
ASSIGNS_�CONTRACT
IS_SIMILAR_TO
WORKS_FOR_�DEPARTMENT
Employees
29
Procurement
Officer/Manager
Contracts
360-Degree View �Track all activities tied to a business owner.
CSV files released by the City of Chicago
Business Understanding
Data Understanding
Graph Model Definition
Knowledge Graph Generation
Mapping Data to Nodes, Relationships and Properties
Integrating information from different sources into the KG unified representation
The resulting KG can support for starting specific investigations
Licenses
Owners
Employees
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
Knowledge Graph Generation
Neo4j
Set-up / Initialization
Record Ingestion and Cleaning
Similarity Rules → Exact Matching
WCC �(Weakly Connected Component)
Louvain
Node Entity Generation
Similarity Rules → Fuzzy Matching
Full Ingestion
Neo4j
Set-up / Initialization
Record Ingestion and Cleaning
Similarity Rules → Exact Matching
WCC �(Weakly Connected Component)
Louvain
Node Entity Generation
Similarity Rules → Fuzzy Matching
Neo4j Full-text Search
Sørensen–Dice
similarity
Similarity Rules
Neo4j
Set-up / Initialization
Record Ingestion and Cleaning
Similarity Rules → Exact Matching
WCC �(Weakly Connected Component)
Louvain
Node Entity Generation
Similarity Rules → Fuzzy Matching
Neo4j Full-text Search
Sørensen–Dice
similarity
75% importing time
Ingestion Bottleneck
Person Record
Licenses
Contracts
Owners
Person
License Record
License Type
Address
Contract Record
Org
Contract
Procur�Type
Contract�Type
Dept
IS_SIMILAR_TO
RECORD_�RESOLVED_TO
Org�Group
WORKS_FOR_�ORG
HAS_LICENSE_TYPE
HAS_�ADDRESS
ORG_HAS_�LICENSE
IS_SIMILAR_TO
BELONGS_TO_ORG_GROUP
HAS_VENDOR
INCLUDED_IN_�CONTRACT
HAS_PROCUR_TYPE
HAS_CONTR_ TYPE
ASSIGNS_�CONTRACT
IS_SIMILAR_TO
WORKS_FOR_�DEPARTMENT
Employees
Neo4j
Set-up / Initialization
Record Ingestion and Cleaning
Similarity Rules → Exact Matching
Similarity Rules → Fuzzy Matching
IS_SIMILAR_TO
Org
Person Record
IS_SIMILAR_TO
Property-based
Property-based
Similarity Rules
Relation-based
Neo4j
Set-up / Initialization
Record Ingestion and Cleaning
Similarity Rules → Exact Matching
WCC �(Weakly Connected Component)
Louvain
Node Entity Generation
Similarity Rules → Fuzzy Matching
Person Record
Person
RECORD_�RESOLVED_TO
Community Detection Algorithms
Person Nodes
IS_SIMILAR_TO
Neo4j
Set-up / Initialization
Record Ingestion and Cleaning
Similarity Rules → Exact Matching
WCC �(Weakly Connected Component)
Louvain
Node Entity Generation
Similarity Rules → Fuzzy Matching
Org
Org�Group
IS_SIMILAR_TO
BELONGS_TO_ORG_GROUP
Community Detection Algorithms
Organization Group Nodes
Person Record
Licenses
Contracts
Owners
Person
License Record
License Type
Address
Contract Record
Org
Contract
Procur�Type
Contract�Type
Dept
IS_SIMILAR_TO
RECORD_�RESOLVED_TO
Org�Group
WORKS_FOR_�ORG
HAS_LICENSE_TYPE
HAS_�ADDRESS
ORG_HAS_�LICENSE
IS_SIMILAR_TO
BELONGS_TO_ORG_GROUP
HAS_VENDOR
INCLUDED_IN_�CONTRACT
HAS_PROCUR_TYPE
HAS_CONTR_ TYPE
ASSIGNS_�CONTRACT
IS_SIMILAR_TO
WORKS_FOR_�DEPARTMENT
Employees
38
Initialize an empty stack of WCCs
Perform a graph traversal and detect weakly connected group of nodes
Construct a new graph (each component is a node) and restore original connections
Initialize a new community for each single node
Evaluate modularity gain, merge communities, apply recursive optimization
Assign communities that maximize the modularity measure
Weakly Connected Component
Louvain
Input Graph
Communities
2. Analysis Phase
From Business Understanding to�Insights Extraction (RDF)
40
Procurement
Officer/Manager
360-Degree View �Track all activities tied to a business owner.
Business Understanding
Full Graph
Understanding
Subgraph Extraction
Validation Rules
Setting
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
LPG
Graph
RDF
Graph
SHACL Rules
Analysis Phase
LangGraph�React�Agent
Rules Generation
Validation Reporting
Contextual Explainability
41
Procurement
Officer/Manager
360-Degree View �Track all activities tied to a business owner.
Business Understanding
Full Graph
Understanding
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
LPG
Graph
Full Graph Understanding
42
Procurement
Officer/Manager
360-Degree Owner View �Track all activities tied to a business owner.
Business Understanding
Full Graph
Understanding
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
LPG
Graph
Full Graph Understanding
MATCH (c:Contract)<-[:INCLUDED_IN_CONTRACT]-(:ContractRecord)-[:HAS_VENDOR]->(:Organization)
-[:BELONGS_TO_ORG_GROUP]->(o:OrganizationGroup)
RETURN DISTINCT elementId(c) as src_id, elementId(o) as dst_id
MATCH (l:LicenseRecord)<-[:ORG_HAS_LICENSE]-(:Organization)
-[:BELONGS_TO_ORG_GROUP]->(o:OrganizationGroup)
RETURN DISTINCT elementId(o) as src_id, elementId(l) as dst_id
43
Procurement
Officer/Manager
360-Degree View �Track all activities tied to a business owner.
Business Understanding
Full Graph
Understanding
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
LPG
Graph
Full Graph Understanding
44
Procurement
Officer/Manager
360-Degree View �Track all activities tied to a business owner.
Business Understanding
Full Graph
Understanding
Subgraph Extraction
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
LPG
Graph
RDF
Graph
Subgraph Extraction
45
Procurement
Officer/Manager
360-Degree View �Track all activities tied to a business owner.
Business Understanding
Full Graph
Understanding
Subgraph Extraction
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
LPG
Graph
RDF
Graph
Subgraph Extraction
object_property_mappings = {
"HAS_VENDOR": {
"src_uri": "http://purl.org/procurement/public-contracts#Contract",
"rel_uri": "http://purl.org/procurement/public-contracts#bidder",
"dst_uri": "http://purl.org/goodrelations/v1#BusinessEntity",
"query": """
MATCH (c:Contract)<-[:INCLUDED_IN_CONTRACT]-(:ContractRecord)� -[:HAS_VENDOR]->(:Organization)� -[:BELONGS_TO_ORG_GROUP]->(o:OrganizationGroup)
RETURN DISTINCT elementId(c) as src_id, elementId(o) as dst_id
"""
}
46
Procurement
Officer/Manager
360-Degree View �Track all activities tied to a business owner.
Business Understanding
Full Graph
Understanding
Subgraph Extraction
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
LPG
Graph
RDF
Graph
Subgraph Extraction
47
Procurement
Officer/Manager
360-Degree View �Track all activities tied to a business owner.
Business Understanding
Full Graph
Understanding
Subgraph Extraction
Validation Rules
Setting
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
LPG
Graph
RDF
Graph
SHACL Rules
Validation Rule Setting
48
Procurement
Officer/Manager
360-Degree Owner View �Track all activities tied to a business owner.
Business Understanding
Full Graph
Understanding
Subgraph Extraction
Validation Rules
Setting
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflicts of Interest�Uncover links between people, contracts, licenses, and departments.
LPG
Graph
RDF
Graph
SHACL Rules
Validation Rule Setting
<#BusinessLicenseContractShape> a sh:NodeShape ;
sh:targetClass gr:BusinessEntity ;
sh:sparql [
a sh:SPARQLConstraint ;
sh:message "The newest license end date must not be before the oldest contract start date." ;
sh:select """ SELECT ?this WHERE {
{
SELECT ?this (MAX(?licenseEndDate) AS ?maxLicenseEndDate) WHERE {
?this a gr:BusinessEntity .
?this gr:hasLicense ?license .
?license pco:actualEndDate ?licenseEndDate .
} GROUP BY ?this
}
{
SELECT ?this (MIN(?contractStartDate) AS ?minContractStartDate) WHERE {
?contract pco:bidder ?this .
?contract pco:startDate ?contractStartDate .
} GROUP BY ?this
}
FILTER(?maxLicenseEndDate < ?minContractStartDate)
}""" ;
] .
49
Procurement
Officer/Manager
360-Degree View �Track all activities tied to a business owner.
Business Understanding
Full Graph
Understanding
Subgraph Extraction
Validation Rules
Setting
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
LPG
Graph
RDF
Graph
SHACL Rules
Validation Rule Setting
50
Procurement
Officer/Manager
360-Degree View �Track all activities tied to a business owner.
Business Understanding
Full Graph
Understanding
Subgraph Extraction
Validation Rules
Setting
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
SHACL Rules
Rules
LangGraph�React�Agent
Rules Generation
LPG
Graph
RDF
Graph
51
Procurement
Officer/Manager
360-Degree View �Track all activities tied to a business owner.
Business Understanding
Full Graph
Understanding
Subgraph Extraction
Validation Rules
Setting
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
RDF
Graph
SHACL Rules
Reporting
LangGraph�React�Agent
Rules Generation
Validation Reporting
LPG
Graph
RDF
Graph
52
Procurement
Officer/Manager
360-Degree View �Track all activities tied to a business owner.
Business Understanding
Full Graph
Understanding
Subgraph Extraction
Validation Rules
Setting
Regulatory Compliance�Detect invalid contracts due to licensing issues.
Conflict of Interest�Uncover links between people, contracts, licenses, and departments.
LPG
Graph
RDF
Graph
SHACL Rules
Explainability
LangGraph�React�Agent
Rules Generation
Validation Reporting
Contextual Explainability
3. Use Cases
Regulatory Compliance, Conflicts of Interest,�360-Degree View
Demo
Regulatory Compliance
Detect invalid contracts due to licensing issues�
https://github.com/giuseppefutia/klab/blob/master/analysis/chicago/01_regulatory_compliance.ipynb
Conflict of Interest
Uncover links between people, contracts, licenses, �and departments.
https://github.com/giuseppefutia/klab/blob/master/analysis/chicago/02_conflict_of_interest.ipynb
360-Degree View
Track all activities tied to a business owner.
https://github.com/giuseppefutia/klab/blob/master/analysis/chicago/03_three_sixty_degree_view.ipynb
We performed multiple analysis combining LPG, RDF, and LLMs
Conclusions
We identified some strategies that are applicable to multiple domains
We built the Chicago KG by integrating multiple data Sources
kgconf25 (45% off all Manning products; expiration May 25)