Goal: Create a package ecosystem for domain knowledgeβlike npm for facts and rules. Enable knowledge reuse across applications.
Key insight: Just as software libraries enable code reuse, semantic libraries enable knowledge reuse with formal guarantees.
Each semantic library contains: type hierarchy declarations, core concepts, relationship definitions, inference rules, integrity constraints, and validation tests.
{
"name": "@sys2/biology",
"version": "1.2.0",
"description": "Biological concepts, taxonomies, and rules",
"keywords": ["biology", "taxonomy", "species", "genetics"],
"dependencies": {
"@sys2/core-relations": "^2.0.0",
"@sys2/units": "^1.0.0"
},
"sys2": {
"entryPoints": ["00-types.sys2", "01-concepts.sys2"],
"exports": {
"concepts": ["Species", "Gene", "Protein", "Cell"],
"relations": ["isA", "partOf", "encodedBy", "expressedIn"]
},
"testSuite": "tests/biology.test.sys2"
}
}
Taxonomic hierarchies (Kingdom β Species), genetic concepts (Gene, Protein, DNA), cellular biology, physiological systems.
Legal entities (Person, Corporation), rights and obligations, contractual relationships, jurisdictional rules.
Symptoms, diseases, treatments, drug interactions, diagnostic pathways, anatomical relationships.
// my-veterinary-app.sys2 // Import base libraries import @sys2/biology import @sys2/medicine // Extend with domain-specific concepts isA VeterinaryMedicine Medicine isA DomesticAnimal Animal // Add specialized rules @r_vet1 Implies (And (isA ?animal DomesticAnimal) (hasSymptom ?animal ?symptom)) (suggestCheckup ?animal Veterinarian) // Customize existing rules @r_vet2 Override @r_med_dosage (scaleDosage ?drug ?animal (bodyWeight ?animal))
| Version Change | Type | Compatibility |
|---|---|---|
| 1.0.0 β 1.0.1 | Patch | Bug fixes, no API changes |
| 1.0.0 β 1.1.0 | Minor | New concepts/rules added, backwards compatible |
| 1.0.0 β 2.0.0 | Major | Breaking changes (renamed concepts, modified rules) |
Every semantic library must pass quality gates:
| Check | Requirement | Tool |
|---|---|---|
| Syntax validation | All files parse without errors | sys2 lint |
| Consistency | No contradictions detected | sys2 check --consistency |
| Completeness | No undefined references | sys2 check --references |
| Test coverage | β₯90% concepts tested | sys2 test --coverage |
| Documentation | All public concepts documented | sys2 doc --check |
# Install a semantic library sys2 install @sys2/biology # Search available libraries sys2 search "medical diagnosis" # Publish your own library sys2 publish --access public # View library contents sys2 info @sys2/biology --concepts
| Phase | Features | Status |
|---|---|---|
| Phase 1 | Basic package structure, local loading | Implemented |
| Phase 2 | Dependency resolution, versioning | In progress |
| Phase 3 | Package registry, discovery | Planned |
| Phase 4 | Conflict resolution, merging | Research |