diff --git a/builder.ts b/builder.ts index aa01d64..25b5630 100644 --- a/builder.ts +++ b/builder.ts @@ -36,7 +36,7 @@ import { type VariableName, type PatternValue, type SparqlTerm, - SparqlExpr, + type SparqlExpr, } from './sparql.ts' import { createExecutor, type BindingMap, type ExecutionConfig, type QueryResult } from './executor.ts' import { bind, filter, optional } from './utils.ts' diff --git a/executor.ts b/executor.ts index ea152b1..bb6eb0d 100644 --- a/executor.ts +++ b/executor.ts @@ -1,6 +1,7 @@ // executor.ts -import sparql, { +import { + sparql, raw, uri, valuesList, @@ -888,6 +889,7 @@ export async function fetchProperties( const uriValue = binding.uri?.value if (!uriValue) continue + // biome-ignore lint/suspicious/noAssignInExpressions: const entry = (result[uriValue] ??= {}) requestedProperties.forEach((prop, index) => { diff --git a/namespaces.ts b/namespaces.ts index 8877911..9cf0e4d 100644 --- a/namespaces.ts +++ b/namespaces.ts @@ -70,7 +70,7 @@ export interface NamespaceLike { * ) * ``` */ -export const XSD: NamespaceLike = { +export const XSD: NamespaceLike = /* @__PURE__ */ { /** Base namespace for all XML Schema datatypes. */ _namespace: 'http://www.w3.org/2001/XMLSchema#', @@ -239,7 +239,7 @@ export const XSD: NamespaceLike = { * .where(triple('?list', RDF.rest, RDF.nil)) * ``` */ -export const RDF: NamespaceLike = { +export const RDF: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', /** Assigns a class to a resource: `?s rdf:type ?class`. */ @@ -338,7 +338,7 @@ export const RDF: NamespaceLike = { * .where(triple('?sub', RDFS.subClassOf, 'narrative:Product')) * ``` */ -export const RDFS: NamespaceLike = { +export const RDFS: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://www.w3.org/2000/01/rdf-schema#', /** Human-readable label. */ @@ -413,7 +413,7 @@ export const RDFS: NamespaceLike = { * where(triple('?comic', OWL.sameAs, '?externalComic')) * ``` */ -export const OWL: NamespaceLike = { +export const OWL: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://www.w3.org/2002/07/owl#', // Core classes @@ -556,7 +556,7 @@ export const OWL: NamespaceLike = { * .optional(triple('?person', FOAF.mbox, '?email')) * ``` */ -export const FOAF: NamespaceLike = { +export const FOAF: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://xmlns.com/foaf/0.1/', // Core classes @@ -691,7 +691,7 @@ export const FOAF: NamespaceLike = { * .where(triple('?p', SCHEMA.price, '?price')) * ``` */ -export const SCHEMA: NamespaceLike = { +export const SCHEMA: NamespaceLike = /* @__PURE__ */ { // Note: schema.org now often uses https:// in docs, but http:// IRIs are widely used. _namespace: 'http://schema.org/', @@ -872,7 +872,7 @@ export const SCHEMA: NamespaceLike = { * **Typical uses** * - Inspecting an endpoint’s capabilities before deciding which features to use. */ -export const SD: NamespaceLike = { +export const SD: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://www.w3.org/ns/sparql-service-description#', Service: 'http://www.w3.org/ns/sparql-service-description#Service', @@ -926,7 +926,7 @@ export const SD: NamespaceLike = { * - Validating datasets before loading them into a KG. * - Encoding business rules and invariants in RDF form. */ -export const SHACL: NamespaceLike = { +export const SHACL: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://www.w3.org/ns/shacl#', // Core classes @@ -1014,7 +1014,7 @@ export const SHACL: NamespaceLike = { * - Modeling genres, subject headings, tag vocabularies. * - Multi-level classification systems for products, story arcs, etc. */ -export const SKOS: NamespaceLike = { +export const SKOS: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://www.w3.org/2004/02/skos/core#', // Core classes @@ -1091,7 +1091,7 @@ export const SKOS: NamespaceLike = { * - Tracking data lineage. * - Recording who asserted which statements and when. */ -export const PROV: NamespaceLike = { +export const PROV: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://www.w3.org/ns/prov#', // Core classes @@ -1140,7 +1140,7 @@ export const PROV: NamespaceLike = { * - Size, links, partitions, example resources. * - SPARQL endpoints and data dumps. */ -export const VOID: NamespaceLike = { +export const VOID: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://rdfs.org/ns/void#', Dataset: 'http://rdfs.org/ns/void#Dataset', @@ -1181,7 +1181,7 @@ export const VOID: NamespaceLike = { * Dublin Core is a generic metadata vocabulary used all over the web * and in many RDF datasets for titles, creators, dates, rights, etc. */ -export const DCTERMS: NamespaceLike = { +export const DCTERMS: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://purl.org/dc/terms/', // Core DC elements (terms flavor) @@ -1223,7 +1223,7 @@ export const DCTERMS: NamespaceLike = { * Simple latitude/longitude/altitude vocabulary for expressing points * on Earth (WGS84). */ -export const GEO: NamespaceLike = { +export const GEO: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://www.w3.org/2003/01/geo/wgs84_pos#', SpatialThing: @@ -1248,7 +1248,7 @@ export const GEO: NamespaceLike = { * - Datatypes for geometries (WKT, GML) * - Topological relations (within, contains, etc.) */ -export const GEOSPARQL: NamespaceLike = { +export const GEOSPARQL: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://www.opengis.net/ont/geosparql#', // Core classes @@ -1286,7 +1286,7 @@ export const GEOSPARQL: NamespaceLike = { * Defines IRI identifiers for spatial functions like distance, buffer, etc., * used in SPARQL `FILTER` expressions. */ -export const GEOF: NamespaceLike = { +export const GEOF: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://www.opengis.net/def/function/geosparql/', distance: @@ -1313,7 +1313,7 @@ export const GEOF: NamespaceLike = { * structured into RDF). You’ll see these IRIs if you round-trip results * via RDF form. */ -export const SPARQL_RESULTS: NamespaceLike = { +export const SPARQL_RESULTS: NamespaceLike = /* @__PURE__ */ { _namespace: 'http://www.w3.org/2005/sparql-results#', ResultSet: diff --git a/patterns/cypher.ts b/patterns/cypher.ts index 892dc4e..5afae27 100644 --- a/patterns/cypher.ts +++ b/patterns/cypher.ts @@ -106,7 +106,8 @@ export function cypher( } // Then parse and add edge patterns - let match + let match: RegExpExecArray | null = null; + // biome-ignore lint/suspicious/noAssignInExpressions: while ((match = edgePattern.exec(result)) !== null) { const fromIdx = parseInt(match[1]) const predicate = toPredicateName(match[2]) diff --git a/patterns/objects.ts b/patterns/objects.ts index b3ffa69..9b73fec 100644 --- a/patterns/objects.ts +++ b/patterns/objects.ts @@ -20,15 +20,15 @@ import { toVarToken, toPredicateName, toRawString, - raw, variable, + raw, + rawTerm, + rawPattern, SPARQL_VALUE_BRAND, SPARQL_PATTERN_BRAND, type SparqlValue, type SparqlTerm, type PatternValue, - rawTerm, - rawPattern, } from '../sparql.ts' import { exprTermString } from '../utils.ts' diff --git a/patterns/triples.ts b/patterns/triples.ts index 1f5e862..958ebe9 100644 --- a/patterns/triples.ts +++ b/patterns/triples.ts @@ -11,8 +11,8 @@ * @module */ -import { isSparqlValue, toVarToken, type SparqlExpr, type SparqlTerm } from '../sparql.ts' -import { raw, toPredicateName, toRawString, type SparqlValue, } from '../sparql.ts' +import type { SparqlExpr, SparqlTerm } from '../sparql.ts' +import { raw, toPredicateName, toRawString, isSparqlValue, toVarToken, } from '../sparql.ts' import { termString, type ExpressionPrimitive } from '../utils.ts' // ============================================================================ diff --git a/sparql.ts b/sparql.ts index 5b9f6a9..ac0e980 100644 --- a/sparql.ts +++ b/sparql.ts @@ -602,6 +602,7 @@ export function escapeString( str: string, quote: '"' | "'" = '"', ): string { + // biome-ignore lint/suspicious/noControlCharactersInRegex: return str.replace(/[\u0000-\u001F\\'"]/g, function (ch: string): string { // Always escape backslash if (ch === '\\') return '\\\\'