/** * Copyright 2020 Inrupt Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the * Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import { LitDataset, UrlString, Thing, Url, ThingLocal, LocalNode, ThingPersisted, ChangeLog } from "./interfaces"; /** * @hidden Scopes are not yet consistently used in Solid and hence not properly implemented in this library yet (the add*() and set*() functions do not respect it yet), so we're not exposing these to developers at this point in time. */ export interface GetThingOptions { /** * Which Named Graph to extract the Thing from. * * If not specified, the Thing will include Quads from all Named Graphs in the given * [[LitDataset]]. **/ scope?: Url | UrlString; } /** * Extract Quads with a given Subject from a [[LitDataset]] into a [[Thing]]. * * @param litDataset The [[LitDataset]] to extract the [[Thing]] from. * @param thingUrl The URL of the desired [[Thing]]. * @param options Not yet implemented. */ export declare function getThingOne(litDataset: LitDataset, thingUrl: UrlString | Url | LocalNode, options?: GetThingOptions): Thing; /** * Get all [[Thing]]s about which a [[LitDataset]] contains Quads. * * @param litDataset The [[LitDataset]] to extract the [[Thing]]s from. * @param options Not yet implemented. */ export declare function getThingAll(litDataset: LitDataset, options?: GetThingOptions): Thing[]; /** * Insert a [[Thing]] into a [[LitDataset]], replacing previous instances of that Thing. * * @param litDataset The LitDataset to insert a Thing into. * @param thing The Thing to insert into the given LitDataset. * @returns A new LitDataset equal to the given LitDataset, but with the given Thing. */ export declare function setThing(litDataset: Dataset, thing: Thing): Dataset & ChangeLog; /** * Remove a Thing from a LitDataset. * * @param litDataset The LitDataset to remove a Thing from. * @param thing The Thing to remove from `litDataset`. * @returns A new [[LitDataset]] equal to the input LitDataset, excluding the given Thing. */ export declare function removeThing(litDataset: Dataset, thing: UrlString | Url | LocalNode | Thing): Dataset & ChangeLog; interface CreateThingLocalOptions { /** * The name that should be used for this [[Thing]] when constructing its URL. * * If not provided, a random one will be generated. */ name?: string; } interface CreateThingPersistedOptions { /** * The URL of the newly created [[Thing]]. */ url: UrlString; } export declare type CreateThingOptions = CreateThingLocalOptions | CreateThingPersistedOptions; /** * Initialise a new [[Thing]] in memory. * * @param options See [[CreateThingOptions]]. */ export declare function createThing(options: CreateThingPersistedOptions): ThingPersisted; export declare function createThing(options?: CreateThingLocalOptions): ThingLocal; /** * Get the URL to a given [[Thing]]. * * @param thing The [[Thing]] you want to obtain the URL from. * @param baseUrl If `thing` is not persisted yet, the base URL that should be used to construct this [[Thing]]'s URL. */ export declare function asUrl(thing: ThingLocal, baseUrl: UrlString): UrlString; export declare function asUrl(thing: ThingPersisted): UrlString; /** @hidden Alias of [[asUrl]] for those who prefer IRI terminology. */ export declare const asIri: typeof asUrl; /** * @param thing The [[Thing]] of which a URL might or might not be known. * @return Whether `thing` has no known URL yet. */ export declare function isThingLocal(thing: ThingPersisted | ThingLocal): thing is ThingLocal; export {};