predicate-skill 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/catalog/catalog.json +36 -0
- package/catalog/codebase.shacl.ttl +24 -0
- package/catalog/codebase.ttl +92 -0
- package/catalog/fhir-core.ttl +32 -0
- package/catalog/foaf.ttl +55 -0
- package/catalog/schema-org-lite.ttl +63 -0
- package/catalog/top.ttl +20 -0
- package/cli.bundle.mjs +35 -20
- package/meta/predicate-meta.ttl +99 -0
- package/meta/version.json +6 -0
- package/package.json +4 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "predicate",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Local reasoning knowledge graph (RDF/OWL) for AI agents — 9 kg_* MCP tools + cross-platform Stop-hook turn extraction (Claude Code + Gemini CLI + OpenCode) + reasoning bridge for action data.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Nordic Agents Research",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"ontologies": [
|
|
4
|
+
{
|
|
5
|
+
"name": "top",
|
|
6
|
+
"description": "Minimal upper ontology — Thing, dependsOn, relatedTo",
|
|
7
|
+
"license": "CC0",
|
|
8
|
+
"files": ["top.ttl"]
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "codebase",
|
|
12
|
+
"description": "Software code structure (files, symbols, calls, modifications)",
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"files": ["codebase.ttl"],
|
|
15
|
+
"shapes": "codebase.shacl.ttl"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "foaf",
|
|
19
|
+
"description": "Friend-of-a-friend — faithful subset of xmlns.com/foaf/0.1",
|
|
20
|
+
"license": "CC0",
|
|
21
|
+
"files": ["foaf.ttl"]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "schema-org-lite",
|
|
25
|
+
"description": "Web entities — faithful subset of schema.org core (soft-typed)",
|
|
26
|
+
"license": "CC-BY-4.0",
|
|
27
|
+
"files": ["schema-org-lite.ttl"]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "fhir-core",
|
|
31
|
+
"description": "HL7 FHIR R4 resource class vocabulary (class hierarchy only; load fhir.ttl for full data modeling)",
|
|
32
|
+
"license": "HL7",
|
|
33
|
+
"files": ["fhir-core.ttl"]
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@prefix sh: <http://www.w3.org/ns/shacl#> .
|
|
2
|
+
@prefix : <https://predicate.dev/codebase#> .
|
|
3
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
4
|
+
|
|
5
|
+
:FileShape a sh:NodeShape ;
|
|
6
|
+
sh:targetClass :File ;
|
|
7
|
+
sh:property [
|
|
8
|
+
sh:path :path ; sh:datatype xsd:string ;
|
|
9
|
+
sh:minCount 1 ; sh:maxCount 1
|
|
10
|
+
] .
|
|
11
|
+
|
|
12
|
+
:SymbolShape a sh:NodeShape ;
|
|
13
|
+
sh:targetClass :Symbol ;
|
|
14
|
+
sh:property [
|
|
15
|
+
sh:path :declaredIn ; sh:class :File ;
|
|
16
|
+
sh:minCount 1 ; sh:maxCount 1
|
|
17
|
+
] .
|
|
18
|
+
|
|
19
|
+
:CommitShape a sh:NodeShape ;
|
|
20
|
+
sh:targetClass :Commit ;
|
|
21
|
+
sh:property [
|
|
22
|
+
sh:path :sha ; sh:datatype xsd:string ;
|
|
23
|
+
sh:minCount 1 ; sh:maxCount 1
|
|
24
|
+
] .
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
@prefix : <https://predicate.dev/codebase#> .
|
|
2
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
3
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
4
|
+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
5
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
6
|
+
|
|
7
|
+
# --- Classes -------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
:Artifact a owl:Class ; rdfs:label "Artifact" .
|
|
10
|
+
:File a owl:Class ; rdfs:subClassOf :Artifact ; rdfs:label "File" .
|
|
11
|
+
:Symbol a owl:Class ; rdfs:subClassOf :Artifact ; rdfs:label "Symbol" .
|
|
12
|
+
:Function a owl:Class ; rdfs:subClassOf :Symbol ; rdfs:label "Function" .
|
|
13
|
+
:Class a owl:Class ; rdfs:subClassOf :Symbol ; rdfs:label "Class" .
|
|
14
|
+
:Module a owl:Class ; rdfs:subClassOf :Artifact ; rdfs:label "Module" .
|
|
15
|
+
:Package a owl:Class ; rdfs:subClassOf :Artifact ; rdfs:label "Package" .
|
|
16
|
+
:EnvVar a owl:Class ; rdfs:subClassOf :Artifact ; rdfs:label "EnvVar" .
|
|
17
|
+
:Commit a owl:Class ; rdfs:label "Commit" .
|
|
18
|
+
:Test a owl:Class ; rdfs:subClassOf :Artifact ; rdfs:label "Test" .
|
|
19
|
+
:Command a owl:Class ; rdfs:label "Shell command invocation" .
|
|
20
|
+
|
|
21
|
+
:Hotspot a owl:Class ; rdfs:subClassOf :File ; rdfs:label "File modified in many sessions" .
|
|
22
|
+
:FlakyCommand a owl:Class ; rdfs:subClassOf :Command ; rdfs:label "Command that has failed in multiple sessions" .
|
|
23
|
+
:ActiveFile a owl:Class ; rdfs:subClassOf :File ; rdfs:label "File modified in the most recent session" .
|
|
24
|
+
|
|
25
|
+
:Function owl:disjointWith :Class .
|
|
26
|
+
:File owl:disjointWith :Symbol .
|
|
27
|
+
|
|
28
|
+
# --- Properties ----------------------------------------------------
|
|
29
|
+
|
|
30
|
+
:declaredIn a owl:ObjectProperty ;
|
|
31
|
+
rdfs:domain :Symbol ; rdfs:range :File ;
|
|
32
|
+
rdfs:label "declared in" .
|
|
33
|
+
|
|
34
|
+
:imports a owl:ObjectProperty , owl:TransitiveProperty ;
|
|
35
|
+
rdfs:domain :Artifact ; rdfs:range :Artifact ;
|
|
36
|
+
rdfs:label "imports" .
|
|
37
|
+
|
|
38
|
+
:calls a owl:ObjectProperty , owl:TransitiveProperty ;
|
|
39
|
+
rdfs:domain :Function ; rdfs:range :Function ;
|
|
40
|
+
rdfs:label "calls" .
|
|
41
|
+
|
|
42
|
+
:reads a owl:ObjectProperty ;
|
|
43
|
+
rdfs:domain :Function ; rdfs:range :EnvVar ;
|
|
44
|
+
rdfs:label "reads env var" .
|
|
45
|
+
|
|
46
|
+
:dependsOn a owl:ObjectProperty , owl:TransitiveProperty ;
|
|
47
|
+
rdfs:label "depends on" .
|
|
48
|
+
|
|
49
|
+
# Property chain: f calls g ∧ g declaredIn h → f dependsOn h
|
|
50
|
+
:dependsOn owl:propertyChainAxiom ( :calls :declaredIn ) .
|
|
51
|
+
|
|
52
|
+
# Imports implies dependsOn
|
|
53
|
+
:imports rdfs:subPropertyOf :dependsOn .
|
|
54
|
+
|
|
55
|
+
:testedBy a owl:ObjectProperty ;
|
|
56
|
+
owl:inverseOf :tests ;
|
|
57
|
+
rdfs:label "tested by" .
|
|
58
|
+
|
|
59
|
+
:tests a owl:ObjectProperty ;
|
|
60
|
+
rdfs:domain :Test ; rdfs:range :Symbol ;
|
|
61
|
+
rdfs:label "tests" .
|
|
62
|
+
|
|
63
|
+
:lastModifiedIn a owl:ObjectProperty , owl:FunctionalProperty ;
|
|
64
|
+
rdfs:domain :Artifact ; rdfs:range :Commit ;
|
|
65
|
+
rdfs:label "last modified in" .
|
|
66
|
+
|
|
67
|
+
:path a owl:DatatypeProperty , owl:FunctionalProperty ;
|
|
68
|
+
rdfs:domain :File ; rdfs:range xsd:string ;
|
|
69
|
+
rdfs:label "path" .
|
|
70
|
+
|
|
71
|
+
:sha a owl:DatatypeProperty , owl:FunctionalProperty ;
|
|
72
|
+
rdfs:domain :Commit ; rdfs:range xsd:string ;
|
|
73
|
+
rdfs:label "sha" .
|
|
74
|
+
|
|
75
|
+
# --- Action predicates (used by the Stop-hook deterministic extractor) ---
|
|
76
|
+
|
|
77
|
+
:commandText a owl:DatatypeProperty ;
|
|
78
|
+
rdfs:domain :Command ; rdfs:range xsd:string ;
|
|
79
|
+
rdfs:label "The literal command string." .
|
|
80
|
+
|
|
81
|
+
:modifiedIn a owl:ObjectProperty ;
|
|
82
|
+
rdfs:domain :File ; rdfs:range <https://predicate.dev/meta#Session> ;
|
|
83
|
+
rdfs:label "File was modified during this session." .
|
|
84
|
+
:createdIn a owl:ObjectProperty ;
|
|
85
|
+
rdfs:domain :File ; rdfs:range <https://predicate.dev/meta#Session> ;
|
|
86
|
+
rdfs:label "File was newly created in this session." .
|
|
87
|
+
:succeededIn a owl:ObjectProperty ;
|
|
88
|
+
rdfs:domain :Command ; rdfs:range <https://predicate.dev/meta#Session> ;
|
|
89
|
+
rdfs:label "Command exited 0 in this session." .
|
|
90
|
+
:failedIn a owl:ObjectProperty ;
|
|
91
|
+
rdfs:domain :Command ; rdfs:range <https://predicate.dev/meta#Session> ;
|
|
92
|
+
rdfs:label "Command exited non-zero in this session." .
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
@prefix fhir: <http://hl7.org/fhir/> .
|
|
2
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
3
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
4
|
+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
5
|
+
|
|
6
|
+
# FHIR core — TRUE subset of HL7 FHIR R4 resource-type vocabulary.
|
|
7
|
+
# Upstream: http://hl7.org/fhir/R4/ License: see HL7 terms
|
|
8
|
+
#
|
|
9
|
+
# This file ships ONLY the resource class hierarchy. The published
|
|
10
|
+
# HL7 FHIR RDF ontology (http://hl7.org/fhir/fhir.ttl) uses a rich
|
|
11
|
+
# value-type metamodel (fhir:link, fhir:CodeableConcept, fhir:Reference,
|
|
12
|
+
# wrapped scalar values, etc.) — flattening Patient.subject, Observation.code
|
|
13
|
+
# etc. into bare OWL properties with rdfs:range xsd:string would NOT be a
|
|
14
|
+
# subset of FHIR-RDF; it would contradict it. So we omit those axioms.
|
|
15
|
+
#
|
|
16
|
+
# If you need full FHIR data modeling, load HL7's published RDF ontology
|
|
17
|
+
# directly (predicate init --mode upload --file fhir.ttl).
|
|
18
|
+
|
|
19
|
+
fhir:Resource a owl:Class ; rdfs:label "Resource" .
|
|
20
|
+
|
|
21
|
+
fhir:Patient a owl:Class ; rdfs:subClassOf fhir:Resource ; rdfs:label "Patient" .
|
|
22
|
+
fhir:Practitioner a owl:Class ; rdfs:subClassOf fhir:Resource ; rdfs:label "Practitioner" .
|
|
23
|
+
fhir:Organization a owl:Class ; rdfs:subClassOf fhir:Resource ; rdfs:label "Organization" .
|
|
24
|
+
fhir:Encounter a owl:Class ; rdfs:subClassOf fhir:Resource ; rdfs:label "Encounter" .
|
|
25
|
+
fhir:Observation a owl:Class ; rdfs:subClassOf fhir:Resource ; rdfs:label "Observation" .
|
|
26
|
+
fhir:Condition a owl:Class ; rdfs:subClassOf fhir:Resource ; rdfs:label "Condition" .
|
|
27
|
+
fhir:Medication a owl:Class ; rdfs:subClassOf fhir:Resource ; rdfs:label "Medication" .
|
|
28
|
+
fhir:MedicationRequest a owl:Class ; rdfs:subClassOf fhir:Resource ; rdfs:label "Medication Request" .
|
|
29
|
+
fhir:Procedure a owl:Class ; rdfs:subClassOf fhir:Resource ; rdfs:label "Procedure" .
|
|
30
|
+
fhir:DiagnosticReport a owl:Class ; rdfs:subClassOf fhir:Resource ; rdfs:label "Diagnostic Report" .
|
|
31
|
+
fhir:AllergyIntolerance a owl:Class ; rdfs:subClassOf fhir:Resource ; rdfs:label "Allergy Intolerance" .
|
|
32
|
+
fhir:Immunization a owl:Class ; rdfs:subClassOf fhir:Resource ; rdfs:label "Immunization" .
|
package/catalog/foaf.ttl
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
|
2
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
3
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
4
|
+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
5
|
+
|
|
6
|
+
# FOAF (Friend Of A Friend) — true subset of the upstream vocabulary.
|
|
7
|
+
# Upstream: http://xmlns.com/foaf/spec/ License: CC0
|
|
8
|
+
# Every axiom below is also asserted (or is strictly entailed) by the
|
|
9
|
+
# published FOAF ontology. We add nothing FOAF does not say.
|
|
10
|
+
|
|
11
|
+
# --- Classes -------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
foaf:Agent a owl:Class ; rdfs:label "Agent" .
|
|
14
|
+
foaf:Person a owl:Class ; rdfs:subClassOf foaf:Agent ; rdfs:label "Person" .
|
|
15
|
+
foaf:Organization a owl:Class ; rdfs:subClassOf foaf:Agent ; rdfs:label "Organization" .
|
|
16
|
+
foaf:Group a owl:Class ; rdfs:subClassOf foaf:Agent ; rdfs:label "Group" .
|
|
17
|
+
foaf:Document a owl:Class ; rdfs:label "Document" .
|
|
18
|
+
foaf:Image a owl:Class ; rdfs:subClassOf foaf:Document ; rdfs:label "Image" .
|
|
19
|
+
foaf:OnlineAccount a owl:Class ; rdfs:label "Online Account" .
|
|
20
|
+
|
|
21
|
+
# --- Object properties --------------------------------------------
|
|
22
|
+
|
|
23
|
+
foaf:knows a owl:ObjectProperty ;
|
|
24
|
+
rdfs:domain foaf:Person ; rdfs:range foaf:Person ;
|
|
25
|
+
rdfs:label "knows" .
|
|
26
|
+
|
|
27
|
+
foaf:member a owl:ObjectProperty ;
|
|
28
|
+
rdfs:domain foaf:Group ; rdfs:range foaf:Agent ;
|
|
29
|
+
rdfs:label "member" .
|
|
30
|
+
|
|
31
|
+
foaf:made a owl:ObjectProperty ;
|
|
32
|
+
rdfs:domain foaf:Agent ;
|
|
33
|
+
rdfs:label "made" .
|
|
34
|
+
|
|
35
|
+
foaf:maker a owl:ObjectProperty ;
|
|
36
|
+
rdfs:range foaf:Agent ;
|
|
37
|
+
owl:inverseOf foaf:made ;
|
|
38
|
+
rdfs:label "maker" .
|
|
39
|
+
|
|
40
|
+
# --- Datatype properties ------------------------------------------
|
|
41
|
+
|
|
42
|
+
# Domains left unconstrained where the FOAF spec does so — over-tightening
|
|
43
|
+
# (e.g. domain foaf:Person on foaf:name) would be a non-subset extension.
|
|
44
|
+
|
|
45
|
+
foaf:name a owl:DatatypeProperty ; rdfs:label "name" .
|
|
46
|
+
foaf:firstName a owl:DatatypeProperty ; rdfs:domain foaf:Person ; rdfs:label "first name" .
|
|
47
|
+
foaf:lastName a owl:DatatypeProperty ; rdfs:domain foaf:Person ; rdfs:label "last name" .
|
|
48
|
+
foaf:age a owl:DatatypeProperty ; rdfs:domain foaf:Agent ; rdfs:label "age" .
|
|
49
|
+
foaf:homepage a owl:DatatypeProperty ; rdfs:label "homepage" .
|
|
50
|
+
|
|
51
|
+
# foaf:mbox is the canonical FOAF identity property — InverseFunctional
|
|
52
|
+
# is core to its meaning. Domain is Agent, not Person.
|
|
53
|
+
foaf:mbox a owl:DatatypeProperty , owl:InverseFunctionalProperty ;
|
|
54
|
+
rdfs:domain foaf:Agent ;
|
|
55
|
+
rdfs:label "email" .
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
@prefix schema: <https://schema.org/> .
|
|
2
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
3
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
4
|
+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
5
|
+
|
|
6
|
+
# Schema.org-lite — true subset of schema.org's published vocabulary.
|
|
7
|
+
# Upstream: https://schema.org/ License: CC-BY-4.0
|
|
8
|
+
#
|
|
9
|
+
# Schema.org deliberately does NOT use rdfs:domain / rdfs:range on its
|
|
10
|
+
# properties — it uses its own schema:domainIncludes / schema:rangeIncludes,
|
|
11
|
+
# which are "soft" expected-type hints, not OWL-style strict constraints.
|
|
12
|
+
# We follow that convention so anything we publish is a faithful subset.
|
|
13
|
+
|
|
14
|
+
schema:domainIncludes a rdf:Property ; rdfs:label "domain includes" .
|
|
15
|
+
schema:rangeIncludes a rdf:Property ; rdfs:label "range includes" .
|
|
16
|
+
|
|
17
|
+
# --- Classes (real schema.org hierarchy) --------------------------
|
|
18
|
+
|
|
19
|
+
schema:Thing a owl:Class ; rdfs:label "Thing" .
|
|
20
|
+
schema:Person a owl:Class ; rdfs:subClassOf schema:Thing ; rdfs:label "Person" .
|
|
21
|
+
schema:Organization a owl:Class ; rdfs:subClassOf schema:Thing ; rdfs:label "Organization" .
|
|
22
|
+
schema:Place a owl:Class ; rdfs:subClassOf schema:Thing ; rdfs:label "Place" .
|
|
23
|
+
schema:Event a owl:Class ; rdfs:subClassOf schema:Thing ; rdfs:label "Event" .
|
|
24
|
+
schema:Product a owl:Class ; rdfs:subClassOf schema:Thing ; rdfs:label "Product" .
|
|
25
|
+
|
|
26
|
+
schema:CreativeWork a owl:Class ; rdfs:subClassOf schema:Thing ; rdfs:label "Creative Work" .
|
|
27
|
+
schema:Article a owl:Class ; rdfs:subClassOf schema:CreativeWork ; rdfs:label "Article" .
|
|
28
|
+
schema:Book a owl:Class ; rdfs:subClassOf schema:CreativeWork ; rdfs:label "Book" .
|
|
29
|
+
schema:Movie a owl:Class ; rdfs:subClassOf schema:CreativeWork ; rdfs:label "Movie" .
|
|
30
|
+
schema:Recipe a owl:Class ; rdfs:subClassOf schema:CreativeWork ; rdfs:label "Recipe" .
|
|
31
|
+
schema:Review a owl:Class ; rdfs:subClassOf schema:CreativeWork ; rdfs:label "Review" .
|
|
32
|
+
schema:WebPage a owl:Class ; rdfs:subClassOf schema:CreativeWork ; rdfs:label "Web Page" .
|
|
33
|
+
schema:SoftwareApplication a owl:Class ; rdfs:subClassOf schema:CreativeWork ; rdfs:label "Software Application" .
|
|
34
|
+
schema:Dataset a owl:Class ; rdfs:subClassOf schema:CreativeWork ; rdfs:label "Dataset" .
|
|
35
|
+
schema:ImageObject a owl:Class ; rdfs:subClassOf schema:CreativeWork ; rdfs:label "Image Object" .
|
|
36
|
+
|
|
37
|
+
# --- Datatype-ish properties --------------------------------------
|
|
38
|
+
|
|
39
|
+
schema:name a rdf:Property ; rdfs:label "name" .
|
|
40
|
+
schema:description a rdf:Property ; rdfs:label "description" .
|
|
41
|
+
schema:url a rdf:Property ; rdfs:label "url" .
|
|
42
|
+
schema:identifier a rdf:Property ; rdfs:label "identifier" .
|
|
43
|
+
schema:datePublished a rdf:Property ; rdfs:label "date published" .
|
|
44
|
+
schema:dateCreated a rdf:Property ; rdfs:label "date created" .
|
|
45
|
+
schema:dateModified a rdf:Property ; rdfs:label "date modified" .
|
|
46
|
+
|
|
47
|
+
# --- Object-ish properties (schema-style soft typing) -------------
|
|
48
|
+
|
|
49
|
+
schema:author a rdf:Property ;
|
|
50
|
+
schema:rangeIncludes schema:Person , schema:Organization ;
|
|
51
|
+
rdfs:label "author" .
|
|
52
|
+
schema:publisher a rdf:Property ;
|
|
53
|
+
schema:rangeIncludes schema:Organization , schema:Person ;
|
|
54
|
+
rdfs:label "publisher" .
|
|
55
|
+
schema:image a rdf:Property ;
|
|
56
|
+
schema:rangeIncludes schema:ImageObject , schema:URL ;
|
|
57
|
+
rdfs:label "image" .
|
|
58
|
+
schema:about a rdf:Property ;
|
|
59
|
+
schema:rangeIncludes schema:Thing ;
|
|
60
|
+
rdfs:label "about" .
|
|
61
|
+
schema:location a rdf:Property ;
|
|
62
|
+
schema:rangeIncludes schema:Place , schema:Organization ;
|
|
63
|
+
rdfs:label "location" .
|
package/catalog/top.ttl
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@prefix : <https://predicate.dev/top#> .
|
|
2
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
3
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
4
|
+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
5
|
+
|
|
6
|
+
# Minimal upper ontology (Predicate v2.0 "start-empty" mode seed)
|
|
7
|
+
|
|
8
|
+
:Thing a owl:Class ;
|
|
9
|
+
rdfs:label "Thing" ;
|
|
10
|
+
rdfs:comment "The universal class. Everything is a Thing." .
|
|
11
|
+
|
|
12
|
+
:dependsOn a owl:ObjectProperty , owl:TransitiveProperty ;
|
|
13
|
+
rdfs:domain :Thing ; rdfs:range :Thing ;
|
|
14
|
+
rdfs:label "depends on" ;
|
|
15
|
+
rdfs:comment "Asymmetric directional dependency. Transitive: A→B and B→C implies A→C." .
|
|
16
|
+
|
|
17
|
+
:relatedTo a owl:ObjectProperty , owl:SymmetricProperty ;
|
|
18
|
+
rdfs:domain :Thing ; rdfs:range :Thing ;
|
|
19
|
+
rdfs:label "related to" ;
|
|
20
|
+
rdfs:comment "Generic symmetric association." .
|
package/cli.bundle.mjs
CHANGED
|
@@ -17149,9 +17149,19 @@ var require_src = __commonJS({
|
|
|
17149
17149
|
|
|
17150
17150
|
// ../predicate-cli/src/docker.ts
|
|
17151
17151
|
import { execSync, spawnSync } from "node:child_process";
|
|
17152
|
-
import { existsSync } from "node:fs";
|
|
17153
|
-
import { resolve, dirname } from "node:path";
|
|
17152
|
+
import { existsSync, cpSync } from "node:fs";
|
|
17153
|
+
import { resolve, dirname, join } from "node:path";
|
|
17154
17154
|
import { fileURLToPath } from "node:url";
|
|
17155
|
+
import { homedir } from "node:os";
|
|
17156
|
+
var DOCKER_SHARED_PREFIXES = ["/Users", "/Volumes", "/private", "/tmp", "/var/folders"];
|
|
17157
|
+
function isDockerAccessible(path) {
|
|
17158
|
+
return DOCKER_SHARED_PREFIXES.some((p2) => path.startsWith(p2));
|
|
17159
|
+
}
|
|
17160
|
+
function stageComposeDir(src) {
|
|
17161
|
+
const dest = join(homedir(), ".predicate", "compose");
|
|
17162
|
+
cpSync(src, dest, { recursive: true, force: true });
|
|
17163
|
+
return dest;
|
|
17164
|
+
}
|
|
17155
17165
|
function findComposeDir() {
|
|
17156
17166
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
17157
17167
|
const candidates = [
|
|
@@ -17163,7 +17173,9 @@ function findComposeDir() {
|
|
|
17163
17173
|
resolve(here, "..", "..", "..", "predicate-server")
|
|
17164
17174
|
].filter((p2) => Boolean(p2));
|
|
17165
17175
|
for (const c2 of candidates) {
|
|
17166
|
-
if (c2 && existsSync(resolve(c2, "docker-compose.yml")))
|
|
17176
|
+
if (c2 && existsSync(resolve(c2, "docker-compose.yml"))) {
|
|
17177
|
+
return isDockerAccessible(c2) ? c2 : stageComposeDir(c2);
|
|
17178
|
+
}
|
|
17167
17179
|
}
|
|
17168
17180
|
throw new Error(
|
|
17169
17181
|
`Could not locate docker-compose.yml. Set PREDICATE_COMPOSE_DIR to the directory containing it, or run from the predicate repo root. Searched: ${candidates.join(", ")}`
|
|
@@ -17274,7 +17286,7 @@ function escapeLiteral(value) {
|
|
|
17274
17286
|
|
|
17275
17287
|
// ../predicate-cli/src/commands/init.ts
|
|
17276
17288
|
import { readFileSync, existsSync as existsSync2, statSync } from "node:fs";
|
|
17277
|
-
import { join, dirname as dirname2, resolve as resolve2 } from "node:path";
|
|
17289
|
+
import { join as join2, dirname as dirname2, resolve as resolve2 } from "node:path";
|
|
17278
17290
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
17279
17291
|
import { createInterface } from "node:readline/promises";
|
|
17280
17292
|
var META = "https://predicate.dev/meta#";
|
|
@@ -17290,16 +17302,19 @@ function hasFlag(args, name) {
|
|
|
17290
17302
|
function findCatalogDir() {
|
|
17291
17303
|
const here = dirname2(fileURLToPath2(import.meta.url));
|
|
17292
17304
|
const candidates = [
|
|
17293
|
-
|
|
17294
|
-
|
|
17295
|
-
|
|
17296
|
-
|
|
17305
|
+
// Bundled-alongside-CLI layout (predicate-skill global install).
|
|
17306
|
+
join2(here, "catalog"),
|
|
17307
|
+
// Monorepo / source-tree layouts.
|
|
17308
|
+
join2(here, "..", "..", "..", "predicate-ontology", "catalog"),
|
|
17309
|
+
join2(here, "..", "predicate-ontology", "catalog"),
|
|
17310
|
+
join2(here, "..", "..", "predicate-ontology", "catalog"),
|
|
17311
|
+
join2(here, "predicate-ontology", "catalog")
|
|
17297
17312
|
];
|
|
17298
|
-
for (const c2 of candidates) if (existsSync2(
|
|
17313
|
+
for (const c2 of candidates) if (existsSync2(join2(c2, "catalog.json"))) return c2;
|
|
17299
17314
|
throw new Error(`catalog directory not found \u2014 checked ${candidates.join(", ")}`);
|
|
17300
17315
|
}
|
|
17301
17316
|
function findMetaTtl(catalogDir) {
|
|
17302
|
-
return
|
|
17317
|
+
return join2(catalogDir, "..", "meta", "predicate-meta.ttl");
|
|
17303
17318
|
}
|
|
17304
17319
|
function help() {
|
|
17305
17320
|
console.log(`predicate init [--mode community|upload|empty] [--ontology NAME] [--file PATH] [--force]
|
|
@@ -17374,7 +17389,7 @@ function validateUserUpload(turtle) {
|
|
|
17374
17389
|
}
|
|
17375
17390
|
async function buildPlanCommunity(ontology) {
|
|
17376
17391
|
const catalogDir = findCatalogDir();
|
|
17377
|
-
const catalog = JSON.parse(readFileSync(
|
|
17392
|
+
const catalog = JSON.parse(readFileSync(join2(catalogDir, "catalog.json"), "utf8"));
|
|
17378
17393
|
const entry = catalog.ontologies.find((o2) => o2.name === ontology);
|
|
17379
17394
|
if (!entry) {
|
|
17380
17395
|
console.error(`predicate init: unknown ontology '${ontology}'. Available: ${catalog.ontologies.map((o2) => o2.name).join(", ")}`);
|
|
@@ -17409,8 +17424,8 @@ async function applyPlan(client, plan, force) {
|
|
|
17409
17424
|
await wipeForInit(client, force);
|
|
17410
17425
|
await loadTtlFile(client, findMetaTtl(plan.catalogDir));
|
|
17411
17426
|
if (plan.kind === "community") {
|
|
17412
|
-
for (const f2 of plan.entry.files) await loadTtlFile(client,
|
|
17413
|
-
if (plan.entry.shapes) await loadTtlFile(client,
|
|
17427
|
+
for (const f2 of plan.entry.files) await loadTtlFile(client, join2(plan.catalogDir, f2));
|
|
17428
|
+
if (plan.entry.shapes) await loadTtlFile(client, join2(plan.catalogDir, plan.entry.shapes));
|
|
17414
17429
|
await writeConfig(client, "community", plan.entry.name);
|
|
17415
17430
|
console.log(`predicate init: ${plan.entry.name} ontology loaded (${plan.entry.description}, license: ${plan.entry.license}).`);
|
|
17416
17431
|
return 0;
|
|
@@ -17429,7 +17444,7 @@ async function applyPlan(client, plan, force) {
|
|
|
17429
17444
|
console.log(`predicate init: uploaded ${plan.abs} (${plan.size} bytes). Schema-learning enabled.`);
|
|
17430
17445
|
return 0;
|
|
17431
17446
|
}
|
|
17432
|
-
await loadTtlFile(client,
|
|
17447
|
+
await loadTtlFile(client, join2(plan.catalogDir, "top.ttl"));
|
|
17433
17448
|
await writeConfig(client, "empty", "top");
|
|
17434
17449
|
console.log(`predicate init: empty mode (meta + top vocabulary loaded). The agent will propose new predicates as needed; sweeper promotes after 3 uses.`);
|
|
17435
17450
|
return 0;
|
|
@@ -17450,7 +17465,7 @@ async function interactive(client, force) {
|
|
|
17450
17465
|
let plan;
|
|
17451
17466
|
if (choice === "1") {
|
|
17452
17467
|
const catalogDir = findCatalogDir();
|
|
17453
|
-
const catalog = JSON.parse(readFileSync(
|
|
17468
|
+
const catalog = JSON.parse(readFileSync(join2(catalogDir, "catalog.json"), "utf8"));
|
|
17454
17469
|
console.log("\nAvailable ontologies:");
|
|
17455
17470
|
for (const o2 of catalog.ontologies) console.log(` - ${o2.name.padEnd(18)} ${o2.description}`);
|
|
17456
17471
|
const name = (await rl.question("\nWhich ontology? ")).trim();
|
|
@@ -28690,7 +28705,7 @@ async function recall(args) {
|
|
|
28690
28705
|
// ../predicate-cli/src/commands/dashboard.ts
|
|
28691
28706
|
import { createServer } from "node:http";
|
|
28692
28707
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
28693
|
-
import { join as
|
|
28708
|
+
import { join as join3, dirname as dirname3 } from "node:path";
|
|
28694
28709
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
28695
28710
|
import { spawn } from "node:child_process";
|
|
28696
28711
|
function parseFlag7(args, name) {
|
|
@@ -28745,11 +28760,11 @@ async function proxyQuery(req, res, fusekiUrl, dataset2) {
|
|
|
28745
28760
|
function findDashboardHtml() {
|
|
28746
28761
|
const here = dirname3(fileURLToPath3(import.meta.url));
|
|
28747
28762
|
const candidates = [
|
|
28748
|
-
|
|
28749
|
-
|
|
28763
|
+
join3(here, "..", "..", "..", "predicate-skill", "dashboard", "index.html"),
|
|
28764
|
+
join3(here, "dashboard", "index.html"),
|
|
28750
28765
|
// bundled cli.bundle.mjs sits next to dashboard/
|
|
28751
|
-
|
|
28752
|
-
|
|
28766
|
+
join3(here, "..", "dashboard", "index.html"),
|
|
28767
|
+
join3(here, "..", "..", "dashboard", "index.html")
|
|
28753
28768
|
];
|
|
28754
28769
|
for (const p2 of candidates) {
|
|
28755
28770
|
try {
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
@prefix pred: <https://predicate.dev/meta#> .
|
|
2
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
3
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
4
|
+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
5
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
6
|
+
|
|
7
|
+
# --- Event class hierarchy ---------------------------------------
|
|
8
|
+
|
|
9
|
+
pred:Event a owl:Class ; rdfs:label "Predicate lifecycle event" .
|
|
10
|
+
|
|
11
|
+
pred:SchemaProposed a owl:Class ; rdfs:subClassOf pred:Event .
|
|
12
|
+
pred:SchemaValidationPassed a owl:Class ; rdfs:subClassOf pred:Event .
|
|
13
|
+
pred:SchemaValidationFailed a owl:Class ; rdfs:subClassOf pred:Event .
|
|
14
|
+
pred:SchemaPromoted a owl:Class ; rdfs:subClassOf pred:Event .
|
|
15
|
+
pred:SchemaRejected a owl:Class ; rdfs:subClassOf pred:Event .
|
|
16
|
+
pred:SchemaRolledBack a owl:Class ; rdfs:subClassOf pred:Event .
|
|
17
|
+
pred:TBoxVersionAdvanced a owl:Class ; rdfs:subClassOf pred:Event .
|
|
18
|
+
|
|
19
|
+
pred:GoalCreated a owl:Class ; rdfs:subClassOf pred:Event .
|
|
20
|
+
pred:GoalStatusChanged a owl:Class ; rdfs:subClassOf pred:Event .
|
|
21
|
+
|
|
22
|
+
pred:InconsistencyDetected a owl:Class ; rdfs:subClassOf pred:Event .
|
|
23
|
+
pred:MaintenanceRun a owl:Class ; rdfs:subClassOf pred:Event .
|
|
24
|
+
|
|
25
|
+
# --- Common event properties -------------------------------------
|
|
26
|
+
|
|
27
|
+
pred:at a owl:DatatypeProperty , owl:FunctionalProperty ;
|
|
28
|
+
rdfs:domain pred:Event ; rdfs:range xsd:dateTime .
|
|
29
|
+
pred:actor a owl:DatatypeProperty ;
|
|
30
|
+
rdfs:domain pred:Event ; rdfs:range xsd:string .
|
|
31
|
+
pred:goal a owl:ObjectProperty ; rdfs:domain pred:Event .
|
|
32
|
+
pred:payload a owl:DatatypeProperty ;
|
|
33
|
+
rdfs:domain pred:Event ; rdfs:range xsd:string .
|
|
34
|
+
|
|
35
|
+
# --- Provenance properties (already used by kg_assert RDF-star) --
|
|
36
|
+
|
|
37
|
+
pred:source a owl:DatatypeProperty ; rdfs:range xsd:string .
|
|
38
|
+
pred:confidence a owl:DatatypeProperty ; rdfs:range xsd:decimal .
|
|
39
|
+
pred:method a owl:DatatypeProperty ; rdfs:range xsd:string .
|
|
40
|
+
pred:timestamp a owl:DatatypeProperty ; rdfs:range xsd:dateTime .
|
|
41
|
+
|
|
42
|
+
# --- Query/usage event class (already used by kg_ask) ------------
|
|
43
|
+
|
|
44
|
+
pred:Query a owl:Class ; rdfs:label "Query execution record" .
|
|
45
|
+
pred:question a owl:DatatypeProperty ; rdfs:domain pred:Query ; rdfs:range xsd:string .
|
|
46
|
+
pred:sparql a owl:DatatypeProperty ; rdfs:domain pred:Query ; rdfs:range xsd:string .
|
|
47
|
+
pred:rowCount a owl:DatatypeProperty ; rdfs:domain pred:Query ; rdfs:range xsd:integer .
|
|
48
|
+
pred:elapsedMs a owl:DatatypeProperty ; rdfs:domain pred:Query ; rdfs:range xsd:integer .
|
|
49
|
+
|
|
50
|
+
# --- Tool-call capture event class (used by kg_capture) ----------
|
|
51
|
+
|
|
52
|
+
pred:ToolCall a owl:Class ; rdfs:label "Captured tool invocation" .
|
|
53
|
+
|
|
54
|
+
pred:toolName a owl:DatatypeProperty ;
|
|
55
|
+
rdfs:domain pred:ToolCall ; rdfs:range xsd:string .
|
|
56
|
+
pred:toolInput a owl:DatatypeProperty ;
|
|
57
|
+
rdfs:domain pred:ToolCall ; rdfs:range xsd:string .
|
|
58
|
+
pred:toolOutput a owl:DatatypeProperty ;
|
|
59
|
+
rdfs:domain pred:ToolCall ; rdfs:range xsd:string .
|
|
60
|
+
pred:sessionId a owl:DatatypeProperty ;
|
|
61
|
+
rdfs:domain pred:ToolCall ; rdfs:range xsd:string .
|
|
62
|
+
pred:phase a owl:DatatypeProperty ;
|
|
63
|
+
rdfs:domain pred:ToolCall ; rdfs:range xsd:string .
|
|
64
|
+
|
|
65
|
+
# --- Session class (used by the Stop-hook extractor) -------------
|
|
66
|
+
|
|
67
|
+
pred:Session a owl:Class ; rdfs:label "Development session" .
|
|
68
|
+
pred:startedAt a owl:DatatypeProperty ;
|
|
69
|
+
rdfs:domain pred:Session ; rdfs:range xsd:dateTime .
|
|
70
|
+
pred:endedAt a owl:DatatypeProperty ;
|
|
71
|
+
rdfs:domain pred:Session ; rdfs:range xsd:dateTime .
|
|
72
|
+
|
|
73
|
+
# --- Peer registry (federation) ----------------------------------
|
|
74
|
+
|
|
75
|
+
pred:Peer a owl:Class ; rdfs:label "Registered federation peer" .
|
|
76
|
+
pred:peerName a owl:DatatypeProperty ;
|
|
77
|
+
rdfs:domain pred:Peer ; rdfs:range xsd:string .
|
|
78
|
+
pred:peerEndpoint a owl:DatatypeProperty ;
|
|
79
|
+
rdfs:domain pred:Peer ; rdfs:range xsd:anyURI .
|
|
80
|
+
pred:peerAddedAt a owl:DatatypeProperty ;
|
|
81
|
+
rdfs:domain pred:Peer ; rdfs:range xsd:dateTime .
|
|
82
|
+
pred:peerKind a owl:DatatypeProperty ;
|
|
83
|
+
rdfs:domain pred:Peer ; rdfs:range xsd:string ;
|
|
84
|
+
rdfs:label "Peer kind tag: 'team' (default) or 'external-ld'" .
|
|
85
|
+
|
|
86
|
+
# --- Bootstrap/init config (v2.0) --------------------------------
|
|
87
|
+
|
|
88
|
+
pred:Config a owl:Class ; rdfs:label "Predicate runtime config singleton" .
|
|
89
|
+
pred:initMode a owl:DatatypeProperty , owl:FunctionalProperty ;
|
|
90
|
+
rdfs:domain pred:Config ; rdfs:range xsd:string ;
|
|
91
|
+
rdfs:comment "One of: community | upload | empty" .
|
|
92
|
+
pred:initOntology a owl:DatatypeProperty , owl:FunctionalProperty ;
|
|
93
|
+
rdfs:domain pred:Config ; rdfs:range xsd:string ;
|
|
94
|
+
rdfs:comment "Catalog name (e.g. codebase, foaf), or 'user' for upload, or 'top' for empty" .
|
|
95
|
+
pred:schemaLearningEnabled a owl:DatatypeProperty , owl:FunctionalProperty ;
|
|
96
|
+
rdfs:domain pred:Config ; rdfs:range xsd:boolean ;
|
|
97
|
+
rdfs:comment "When false, Generalizer skips auto-proposal generation (Sweeper still promotes existing staging)" .
|
|
98
|
+
pred:initializedAt a owl:DatatypeProperty , owl:FunctionalProperty ;
|
|
99
|
+
rdfs:domain pred:Config ; rdfs:range xsd:dateTime .
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "predicate-skill",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Local reasoning knowledge graph (RDF/OWL) for AI agents — Claude Code plugin + MCP server + predicate CLI.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Nordic Agents Research",
|
|
@@ -30,13 +30,15 @@
|
|
|
30
30
|
"commands",
|
|
31
31
|
"hooks",
|
|
32
32
|
"compose",
|
|
33
|
+
"catalog",
|
|
34
|
+
"meta",
|
|
33
35
|
"dashboard",
|
|
34
36
|
"LICENSE",
|
|
35
37
|
"README.md"
|
|
36
38
|
],
|
|
37
39
|
"scripts": {
|
|
38
40
|
"bundle": "node scripts/bundle.mjs",
|
|
39
|
-
"prepublishOnly": "node scripts/bundle.mjs && node -e \"const fs=require('fs');for(const f of ['server.bundle.mjs','cli.bundle.mjs']){if(!fs.existsSync(f)){console.error('missing '+f);process.exit(1)}}\""
|
|
41
|
+
"prepublishOnly": "node scripts/bundle.mjs && node -e \"const fs=require('fs');for(const f of ['server.bundle.mjs','cli.bundle.mjs','catalog/catalog.json','meta/predicate-meta.ttl']){if(!fs.existsSync(f)){console.error('missing '+f);process.exit(1)}}\""
|
|
40
42
|
},
|
|
41
43
|
"engines": {
|
|
42
44
|
"node": ">=20"
|