@faubulous/mentor-rdf 0.3.2 → 0.4.0

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.
@@ -95,12 +95,13 @@ export declare class Store implements rdfjs.Source<rdfjs.Quad> {
95
95
  loadFromXmlStream(input: string | EventEmitter, graphUri: string, executeInference?: boolean, clearGraph?: boolean, onQuad?: (quad: rdfjs.Quad) => void): Promise<Store>;
96
96
  /**
97
97
  * Write the triples in the store into a string in Turtle format.
98
- * @param graphUri A graph URI.
99
- * @returns A string serialization of the triples in the graph in Turtle format.
98
+ * @param sourceGraphUri A graph URI.
99
+ * @param targetFormat Optional mime type of the serialization format (e.g., 'text/turtle').
100
+ * @param targetGraphUri Optional target graph URI. If not provided, the source graph URI will be used for serialization formats that support quads.
101
+ * @param prefixes Optional prefixes to be used in the serialization.
102
+ * @returns A string serialization of the triples in the graph in the specified format.
100
103
  */
101
- serializeGraph(graphUri: string, prefixes?: {
102
- [prefix: string]: rdfjs.NamedNode<string>;
103
- }, format?: string): Promise<string>;
104
+ serializeGraph(sourceGraphUri: string, targetFormat?: string, targetGraphUri?: string, prefixes?: Record<string, string>): Promise<string>;
104
105
  /**
105
106
  * Indicates if the store contains triples in a given graph.
106
107
  * @param graphUri A graph URI.
@@ -0,0 +1,14 @@
1
+ import * as rdfjs from "@rdfjs/types";
2
+ import * as rdflib from "rdflib";
3
+ /**
4
+ * Converts an rdflib term to an RDFJS term.
5
+ * @param term The rdflib term to convert.
6
+ * @returns The corresponding RDFJS term.
7
+ */
8
+ export declare const toRdfjsTerm: (term: rdflib.Node) => rdfjs.Term;
9
+ /**
10
+ * Converts an RDFJS term to an rdflib term adding compareTerm methods required by rdflib serializers.
11
+ * @param term The RDFJS term to convert.
12
+ * @returns The corresponding rdflib term.
13
+ */
14
+ export declare const toRdflibTerm: (term: rdfjs.Term) => rdflib.NamedNode | rdflib.BlankNode | rdflib.Literal;