Registry / data / cfgraph

cfgraph

JSON →
library0.2.1pypypi✓ verified 84d ago

CFGraph is a Python library that provides a flattening graph for RDFlib collections, converting RDF collection structures into a simplified graph representation. Version 0.2.1 is the latest release, with an irregular release cadence.

pip install cfgraph
INSTALL
IMPORT
SIG · CFGRAPH
C
cfgraph
datapythonv0.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CFGraph
✓ from CFGraph import CFGraph
✗ from cfgraph import Flattener
Graph
✓ from CFGraph import Graph
BNode
✓ from CFGraph import BNode

Basic usage: parse an RDF graph and flatten all collections using the Flattener class.

import rdflib from cfgraph import Flattener # Load an RDF graph g = rdflib.Graph() g.parse('example.ttl', format='turtle') # Flatten collections flattener = Flattener(g) flattener.flatten() # The graph now has flattened collections print(f"Number of triples after flattening: {len(g)}")
Debug
Known issues
gotchaThe Flattener modifies the graph in-place. Make a copy if you need to preserve the original graph.
fix
Use `g2 = rdflib.Graph()` and parse again, or use `g2 = g + g` (but careful with blank nodes).
affects: all
gotchaCFGraph only works with RDF collections that follow the standard rdf:first/rdf:rest pattern. Other collection representations are not supported.
fix
Ensure your data uses the standard RDF collection pattern.
affects: all
deprecatedThe library has not been updated in several years and may have compatibility issues with newer versions of rdflib (e.g., rdflib >= 6.0).
fix
Use with rdflib < 6.0 or test compatibility.
affects: 0.2.1
Upgrade
Version history
0.2.1latest on PyPI · released Nov 20, 2018
Audit
Dependencies
rdflibrequiredCFGraph requires rdflib to work with RDF graphs.
Agent activity
13 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
cfgraph — pip install cfgraph · libregistry