Options
All
  • Public
  • Public/Protected
  • All
Menu

ts-rdf-mapper

Index

Type aliases

RDFBlankNode

RDFBlankNode: BlankNode

Convenience alias type for BlankNode from 'n3'

RDFLiteral

RDFLiteral: Literal

Convenience alias type for Literal from 'n3'

RDFResourceIRI

RDFResourceIRI: NamedNode

Convenience alias type for NamedNode from 'n3'

RDFTriple

RDFTriple: Triple

Convenience alias type for Triple from 'n3'

Triple_Object

Triple_Predicate

Triple_Predicate: RDFResourceIRI

Triple_Subject

Triple_Subject: RDFResourceIRI | RDFBlankNode

Functions

Const RdfBean

  • RdfBean(value: string): (Anonymous function)
  • Optional - Defines the type (xsd:type) of Resource,

    Basic usage and result example:

    @RdfPrefixes({
      foaf: 'http://xmlns.com/foaf/0.1/',
      person: 'http://example.com/Person/'
    })
    @RdfBean('foaf:Person')
    export class Person {
     @RdfSubject('person')
     public name: string;
    }
    
    const p = new Person();
    p.name = 'John';
    RdfMapper.serialize(p)

    produces the following TURTLE:

    @prefix foaf: <http://xmlns.com/foaf/0.1/>.
    @prefix person: <http://example.com/Person/>.
    @prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
    
    person:John a foaf:Person;

    Parameters

    • value: string

      a IRI in the form of 'http(s)://schema.org/Person or prefixed version e.g. 'schema:Person'

    Returns (Anonymous function)

Const RdfPrefixes

  • RdfPrefixes(prefixes?: IRdfPrefixes): (Anonymous function)
  • Responsible of defining prefixes and it's corresponding URIs

    Basic usage example:

    @RdfPrefixes({
      foaf: 'http://xmlns.com/foaf/0.1/',
      person: 'http://example.com/Person/'
    })
    export class Person {
    
    }

    Parameters

    Returns (Anonymous function)

Const RdfProperty

  • Used to annotate object properties

    Parameters

    Returns (Anonymous function)

Const RdfSubject

  • RdfSubject(prop: string): (Anonymous function)
  • Optional - Resource Identifier. If this decorator is absent then the subject will be a Blank Node

    Basic usage and result example:

    @RdfNamespaces({
      foaf: 'http://xmlns.com/foaf/0.1/',
      person: 'http://example.com/Person/'
    })
    @RdfBean('foaf:Person')
    export class Person {
     @RdfSubject('person')
     public name: string;
    }
    
    const p = new Person();
    p.name = 'John';
    RdfMapper.serialize(p)

    produces the following TURTLE:

    @prefix foaf: <http://xmlns.com/foaf/0.1/>.
    @prefix person: <http://example.com/Person/>.
    @prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
    
    person:John a foaf:Person;

    Parameters

    • prop: string

    Returns (Anonymous function)

Generated using TypeDoc