mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
Add a Cite Us section to the README with BibTeX citation info, and align it with docs/citation.md (author/organization: Semantica, 2026). Update LICENSE and docs/project-license.md copyright holder to Semantica, and replace the stale Hawksight-AI GitHub org slug with semantica-agi across READMEs, plugin manifests, cookbook notebooks, and GitHub templates.
13 KiB
13 KiB
In [ ]:
!pip install semanticaIn [ ]:
from semantica.export import JSONExporter
from semantica.kg import GraphBuilder
# Create exporter and builder
json_exporter = JSONExporter()
builder = GraphBuilder()
# Create sample knowledge graph
entities = [{"id": "e1", "type": "Organization", "name": "Apple Inc.", "properties": {}}]
relationships = []
kg = builder.build(entities + relationships)
# Export to JSON
json_exporter.export_knowledge_graph(kg, "output.json")
In [ ]:
from semantica.export import CSVExporter
# Create CSV exporter
csv_exporter = CSVExporter()
# Export entities to CSV
csv_exporter.export_entities(entities, "entities.csv")
In [ ]:
from semantica.export import RDFExporter
# Create RDF exporter
rdf_exporter = RDFExporter()
# Export to RDF format (Turtle by default)
rdf_exporter.export(kg, "output.ttl", format="turtle")In [ ]:
# TTL alias: format="ttl" is equivalent to format="turtle"
rdf_data = {
"entities": [
{"id": "e1", "text": "Apple Inc.", "type": "ORG", "confidence": 0.95},
{"id": "e2", "text": "Steve Jobs", "type": "PERSON", "confidence": 0.97},
],
"relationships": [
{"source_id": "e2", "target_id": "e1", "type": "founded_by", "confidence": 0.91},
],
}
rdf_exporter.export(rdf_data, "output.ttl", format="ttl")
result = rdf_exporter.validate_rdf(rdf_data)
print(f"Valid: {result['overall_valid']}")In [ ]:
from semantica.export import GraphExporter
# Create graph exporter
graph_exporter = GraphExporter()
# Export to GraphML format
graph_exporter.export_knowledge_graph(kg, "output.graphml", format="graphml")
In [ ]:
from semantica.export import OWLExporter
from semantica.ontology import OntologyGenerator
# Create OWL exporter and ontology generator
owl_exporter = OWLExporter()
generator = OntologyGenerator()
# Generate ontology from entities and relationships
# Note: Pass data as a dictionary to generate_ontology
ontology = generator.generate_ontology({
"entities": entities,
"relationships": relationships
})
# Export ontology to OWL
owl_exporter.export(ontology, "output.owl")