How to use @zazuko/rdf-vocabularies - 7 common examples

To help you get started, we’ve selected a few @zazuko/rdf-vocabularies examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wikibus / Alcaeus / tests / Resources / Mixins / OperationFinder-spec.ts View on Github external
it('excludes objects of hydra:member property by default', () => {
            // given
            const topLevel = new TestOperationFinder([ ], {
                [expand('hydra:member')]: new TestOperationFinder([ {} ], {
                    child: new TestOperationFinder([ {} ]),
                }),
            })

            // when
            const operations = topLevel.getOperationsDeep()

            // then
            expect(operations).toHaveLength(0)
        })
github wikibus / Alcaeus / tests / Resources / Mixins / OperationFinder-spec.ts View on Github external
it('includes by expected class id', () => {
            // given
            const deleteOperation = { expects: { id: expand('owl:Nothing') } }
            const getOperation = { expects: { id: expand('owl:Nothing') } }
            const postOperation = { expects: { id: 'http://example.com/Person' } }
            const resource = new TestOperationFinder([
                deleteOperation, getOperation, postOperation,
            ])

            // when
            const operations = resource.findOperations({
                expecting: 'http://example.com/Person',
            })

            // then
            expect(operations).toHaveLength(1)
            expect(operations).toContain(postOperation)
        })
github wikibus / Alcaeus / tests / test-utils.ts View on Github external
return async () => {
        const dataset = rdf.dataset()
        const stream = stringToStream(`
    BASE 
    PREFIX rdf: <${prefixes.rdf}>
    PREFIX rdfs: <${prefixes.rdfs}>
    PREFIX foaf: <${prefixes.foaf}>
    PREFIX hydra: <${prefixes.hydra}>

    ${ntriples}`)
        return dataset.import(await parser.import(stream))
    }
}
github wikibus / Alcaeus / tests / test-utils.ts View on Github external
return async () => {
        const dataset = rdf.dataset()
        const stream = stringToStream(`
    BASE 
    PREFIX rdf: <${prefixes.rdf}>
    PREFIX rdfs: <${prefixes.rdfs}>
    PREFIX foaf: <${prefixes.foaf}>
    PREFIX hydra: <${prefixes.hydra}>

    ${ntriples}`)
        return dataset.import(await parser.import(stream))
    }
}
github wikibus / Alcaeus / tests / test-utils.ts View on Github external
return async () => {
        const dataset = rdf.dataset()
        const stream = stringToStream(`
    BASE 
    PREFIX rdf: <${prefixes.rdf}>
    PREFIX rdfs: <${prefixes.rdfs}>
    PREFIX foaf: <${prefixes.foaf}>
    PREFIX hydra: <${prefixes.hydra}>

    ${ntriples}`)
        return dataset.import(await parser.import(stream))
    }
}
github wikibus / Alcaeus / tests / test-utils.ts View on Github external
return async () => {
        const dataset = rdf.dataset()
        const stream = stringToStream(`
    BASE 
    PREFIX rdf: <${prefixes.rdf}>
    PREFIX rdfs: <${prefixes.rdfs}>
    PREFIX foaf: <${prefixes.foaf}>
    PREFIX hydra: <${prefixes.hydra}>

    ${ntriples}`)
        return dataset.import(await parser.import(stream))
    }
}
github wikibus / Alcaeus / src / Resources / CoreMixins / OperationFinder.ts View on Github external
public getOperationsDeep (
            stopConditions: RecursiveStopConditions = { excludedProperties: expand('hydra:member') },
            previousResources: OperationFinderMixinClass[] = []) {
            return Object.entries(this)
                .reduce(toResourceWithOperations(stopConditions), [] as OperationFinderMixinClass[])
                .reduce((operations, resource, index, resources) => {
                    if (previousResources.includes(resource)) return operations

                    const currentlyVisited = [...resources, ...previousResources, this]

                    return [
                        ...operations,
                        ...resource.getOperationsDeep(stopConditions, currentlyVisited),
                    ]
                }, this.operations)
        }

@zazuko/rdf-vocabularies

Access most commonly used RDF ontologies/schemas/vocabularies as datasets or n-quads

MIT
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis