WebInterface

WebInterface

Manage Web RDF Data

Constructor

new WebInterface(app)

Parameters:
Name Type Description
app SAFEApp
Source:

Methods

(async) addPublicNameToDirectory(publicName, subNamesRdfLocation) → {Promise}

Add entry to _publicNames container, linking to a specific RDF/MD object for subName discovery/service resolution

Parameters:
Name Type Description
publicName String

public name string, valid URL

subNamesRdfLocation NameAndTag

MutableData name/typeTag object

Source:
Throws:
Example
const asyncFn = async () => {
    try {
        const networkResource = await app.fetch('safe://hyfktce85xaif4kdamgnd16uho3w5z7peeb5zeho836uoi48tgkgbc55bco:30303');
        const nameAndTag = await networkResource.content.getNameAndTag();
        const publicName = 'safedev';
        const subNamesRdfLocation = nameAndTag;
        await app.web.addPublicNameToDirectory(publicName, subNamesRdfLocation);
    } catch(err) {
        throw err;
    }
};

(async) addWebIdToDirectory(webIdUri, displayName)

Adds a WebID to the '_public' container, using

Parameters:
Name Type Description
webIdUri String

name/typetag object from SAFE MD.

displayName String

optional displayName which will be used when listing webIds.

Source:
Throws:

(async) getPublicNames() → {Promise.<Array>}

Return an Array of publicNames

Source:

getVocabs(rdf) → {Object}

Retrieve vocab for RDF/SAFE Implementation of DNS (publicNames/subDomains/services)

Parameters:
Name Type Description
rdf RDF

RDF object to utilise for namespace func

Source:
Example
const rdf = mData.emulateAs('RDF');
const vocabs = app.web.getVocabs(rdf);

(async) getWebIds() → {Promise.<Array>}

Retrieve all webIds. Currently as array of JSON objects...

Source:

(async) linkServiceToSubname(subName, publicName, serviceLocation) → {Promise.<Object>}

Links a service/resource to a publicName, with a provided subName

Parameters:
Name Type Description
subName String
publicName String
serviceLocation NameAndTag
Source:
Throws: