rust-kgdb 0.8.21 → 0.8.22

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.
@@ -46,6 +46,8 @@ function loadNativeBindingDirect() {
46
46
  }
47
47
 
48
48
  const native = loadNativeBindingDirect()
49
+
50
+ // Native Rust bindings - SDK is THIN, all logic lives in Rust
49
51
  const {
50
52
  OlogSchema,
51
53
  PredicateResolverService,
@@ -838,12 +840,12 @@ class SchemaContext {
838
840
  // STRATEGY 2: Extract RDFS/OWL explicit schema (if VoID incomplete)
839
841
  if (ctx.classes.size < 10) {
840
842
  const classQuery = `
841
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
842
- PREFIX owl: <http://www.w3.org/2002/07/owl#>
843
843
  SELECT DISTINCT ?class ?super ?label WHERE {
844
- { ?class a rdfs:Class } UNION { ?class a owl:Class }
845
- OPTIONAL { ?class rdfs:subClassOf ?super }
846
- OPTIONAL { ?class rdfs:label ?label }
844
+ { ?class <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> }
845
+ UNION
846
+ { ?class <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> }
847
+ OPTIONAL { ?class <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?super }
848
+ OPTIONAL { ?class <http://www.w3.org/2000/01/rdf-schema#label> ?label }
847
849
  } LIMIT ${config.maxClasses}
848
850
  `
849
851
  const classResults = kg.querySelect(classQuery)
@@ -860,14 +862,15 @@ class SchemaContext {
860
862
  // STRATEGY 3: Extract property morphisms with domain/range
861
863
  if (ctx.properties.size < 10) {
862
864
  const propQuery = `
863
- PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
864
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
865
- PREFIX owl: <http://www.w3.org/2002/07/owl#>
866
865
  SELECT DISTINCT ?prop ?domain ?range ?label WHERE {
867
- { ?prop a rdf:Property } UNION { ?prop a owl:ObjectProperty } UNION { ?prop a owl:DatatypeProperty }
868
- OPTIONAL { ?prop rdfs:domain ?domain }
869
- OPTIONAL { ?prop rdfs:range ?range }
870
- OPTIONAL { ?prop rdfs:label ?label }
866
+ { ?prop <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> }
867
+ UNION
868
+ { ?prop <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#ObjectProperty> }
869
+ UNION
870
+ { ?prop <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#DatatypeProperty> }
871
+ OPTIONAL { ?prop <http://www.w3.org/2000/01/rdf-schema#domain> ?domain }
872
+ OPTIONAL { ?prop <http://www.w3.org/2000/01/rdf-schema#range> ?range }
873
+ OPTIONAL { ?prop <http://www.w3.org/2000/01/rdf-schema#label> ?label }
871
874
  } LIMIT ${config.maxProperties}
872
875
  `
873
876
  const propResults = kg.querySelect(propQuery)
@@ -922,11 +925,9 @@ class SchemaContext {
922
925
  //
923
926
  // ALWAYS extract entities - they are essential for entity resolution
924
927
  const entityQuery = `
925
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
926
- PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
927
928
  SELECT DISTINCT ?entity ?label ?type WHERE {
928
- ?entity rdfs:label ?label .
929
- OPTIONAL { ?entity a ?type }
929
+ ?entity <http://www.w3.org/2000/01/rdf-schema#label> ?label .
930
+ OPTIONAL { ?entity <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type }
930
931
  } LIMIT ${config.maxEntities || 1000}
931
932
  `
932
933
  try {
@@ -1037,15 +1038,13 @@ class SchemaContext {
1037
1038
  try {
1038
1039
  // Extract classes (Objects in schema category)
1039
1040
  const classQuery = `
1040
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
1041
- PREFIX owl: <http://www.w3.org/2002/07/owl#>
1042
- PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
1043
1041
  SELECT DISTINCT ?class ?super ?label ?comment WHERE {
1044
- { ?class a rdfs:Class }
1045
- UNION { ?class a owl:Class }
1046
- OPTIONAL { ?class rdfs:subClassOf ?super }
1047
- OPTIONAL { ?class rdfs:label ?label }
1048
- OPTIONAL { ?class rdfs:comment ?comment }
1042
+ { ?class <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> }
1043
+ UNION
1044
+ { ?class <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> }
1045
+ OPTIONAL { ?class <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?super }
1046
+ OPTIONAL { ?class <http://www.w3.org/2000/01/rdf-schema#label> ?label }
1047
+ OPTIONAL { ?class <http://www.w3.org/2000/01/rdf-schema#comment> ?comment }
1049
1048
  } LIMIT ${CONFIG.schema.maxClasses}
1050
1049
  `
1051
1050
  const classResults = loadedKg.querySelect(classQuery)
@@ -1069,17 +1068,15 @@ class SchemaContext {
1069
1068
 
1070
1069
  // Extract properties (Morphisms with domain/range)
1071
1070
  const propQuery = `
1072
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
1073
- PREFIX owl: <http://www.w3.org/2002/07/owl#>
1074
- PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
1075
- SELECT DISTINCT ?prop ?domain ?range ?label ?functional WHERE {
1076
- { ?prop a rdf:Property }
1077
- UNION { ?prop a owl:ObjectProperty }
1078
- UNION { ?prop a owl:DatatypeProperty }
1079
- OPTIONAL { ?prop rdfs:domain ?domain }
1080
- OPTIONAL { ?prop rdfs:range ?range }
1081
- OPTIONAL { ?prop rdfs:label ?label }
1082
- OPTIONAL { ?prop a owl:FunctionalProperty . BIND(true AS ?functional) }
1071
+ SELECT DISTINCT ?prop ?domain ?range ?label WHERE {
1072
+ { ?prop <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> }
1073
+ UNION
1074
+ { ?prop <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#ObjectProperty> }
1075
+ UNION
1076
+ { ?prop <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#DatatypeProperty> }
1077
+ OPTIONAL { ?prop <http://www.w3.org/2000/01/rdf-schema#domain> ?domain }
1078
+ OPTIONAL { ?prop <http://www.w3.org/2000/01/rdf-schema#range> ?range }
1079
+ OPTIONAL { ?prop <http://www.w3.org/2000/01/rdf-schema#label> ?label }
1083
1080
  } LIMIT ${CONFIG.schema.maxProperties}
1084
1081
  `
1085
1082
  const propResults = loadedKg.querySelect(propQuery)
@@ -1088,14 +1085,13 @@ class SchemaContext {
1088
1085
  const domain = r.bindings?.domain || r.domain
1089
1086
  const range = r.bindings?.range || r.range
1090
1087
  const label = r.bindings?.label || r.label
1091
- const functional = r.bindings?.functional || r.functional
1092
1088
  if (prop) {
1093
1089
  ctx.properties.set(prop, {
1094
1090
  uri: prop,
1095
1091
  domain: domain || null,
1096
1092
  range: range || null,
1097
1093
  label: label || null,
1098
- functional: !!functional,
1094
+ functional: false,
1099
1095
  source
1100
1096
  })
1101
1097
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rust-kgdb",
3
- "version": "0.8.21",
3
+ "version": "0.8.22",
4
4
  "description": "High-performance RDF/SPARQL database with AI agent framework and cross-database federation. GraphDB (449ns lookups, 5-11x faster than RDFox), HyperFederate (KGDB + Snowflake + BigQuery), GraphFrames analytics, Datalog reasoning, HNSW vector embeddings. HyperMindAgent for schema-aware query generation with audit trails. W3C SPARQL 1.1 compliant. Native performance via Rust + NAPI-RS.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
Binary file
Binary file