Skip to content

Latest commit

 

History

History
216 lines (172 loc) · 8.61 KB

overwrite.js.md

File metadata and controls

216 lines (172 loc) · 8.61 KB

overwrite.js

Without an overwrite.js file, the VSB is configured to take https://leipert.io/sparql as Endpoint. Examples of overwrite.js files can be found in the config folder.

Basic structure

The `overwrite.js is a basic angular.js file, which gets executed before the app runs. The minimum structure would be:

'use strict';

angular.module('VSB.config')
    .config(function (globalConfig) {
        globalConfig.name = 'FOO';
        //...
    });

The globalConfig.name property must be set. You can replace //... with other config properties you want to overwrite.

List of properties

defaultGraphURIs

Default Graph URIS, used in meta and result queries. Defaults to:

    globalConfig.defaultGraphURIs = ['http://xmlns.com/foaf/0.1/', 'http://vsb.leipert.io/ns/'];

endPointQueries

Queries used to recieve metadata from server, defaults to

    globalConfig.endPointQueries = {
        getDirectProperties: '<%uri%> (rdfs:subClassOf|(owl:equivalentClass|^owl:equivalentClass))* ?class .' +
            '?uri rdfs:domain ?class .' +
            'OPTIONAL { ?uri rdfs:range ?range }  .' +
            'OPTIONAL { ?uri rdf:type ?type }  .' +
            'OPTIONAL { ?uri rdfs:label ?label . BIND(LANG(?label) AS ?label_loc) } .' +
            'OPTIONAL { ?uri rdfs:comment ?comment . BIND(LANG(?comment) AS ?comment_loc) } .' +
            'FILTER ( !isBlank(?class) && !isBlank(?uri) && !isBlank(?range) ) ',
        getInverseProperties: '<%uri%> (rdfs:subClassOf|(owl:equivalentClass|^owl:equivalentClass))* ?class .' +
            '?uri rdfs:range ?class .' +
            'OPTIONAL { ?uri rdfs:domain ?range }  .' +
            'OPTIONAL { ?uri rdf:type ?type }  .' +
            'OPTIONAL { ?uri rdfs:label ?label . BIND(LANG(?label) AS ?label_loc) } .' +
            'OPTIONAL { ?uri rdfs:comment ?comment . BIND(LANG(?comment) AS ?comment_loc) } .' +
            'FILTER ( !isBlank(?class) && !isBlank(?uri) && !isBlank(?range) ) ',
        getSuperAndEqClasses: '<%uri%> (rdfs:subClassOf|(owl:equivalentClass|^owl:equivalentClass))* ?uri ' +
            'FILTER ( !isBlank(?uri) )',
        getSubAndEqClasses: '<%uri%> (^rdfs:subClassOf|(owl:equivalentClass|^owl:equivalentClass))* ?uri ' +
            'FILTER ( !isBlank(?uri) )',
        getAvailableClasses: '{?uri a rdfs:Class .} UNION {?uri a owl:Class .} .' +
            'FILTER ( !isBlank(?uri) )' +
            'OPTIONAL { ?uri rdfs:label ?label . BIND(LANG(?label) AS ?label_loc) } .' +
            'OPTIONAL { ?uri rdfs:comment ?comment . BIND(LANG(?comment) AS ?comment_loc)} '
    }
});

If you just want to overwrite one of the queries you can do so:

    globalConfig.endPointQueries.getDirectProperties = //...

The queries just contain the inner part of a SPARQL SELECT Query (so SELECT { QUERY }). The used query parameters are mandatory, otherwise

Below are all used queries explained:

getAvailableClasses

Loads all available classes from the endpoint. Contains the query parameters:

  • ?uri mandatory: the uri of the class
  • ?label & ?label_loc optional: contain the label of the class and it's language
  • ?comment & ?comment_loc optional: contain the comment for a class and it's language

Defaults to:

{?uri a rdfs:Class .} UNION {?uri a owl:Class .} .
FILTER ( !isBlank(?uri) ) .
OPTIONAL { ?uri rdfs:label ?label . BIND(LANG(?label) AS ?label_loc) } .
OPTIONAL { ?uri rdfs:comment ?comment . BIND(LANG(?comment) AS ?comment_loc)}

getDirectProperties

Loads all direct properties of a class, once a class is added to the workspace. For example Person : age : integer or Person: Employer : Company. Contains the query parameters:

  • <%uri%> mandatory: Will be replaced with the uri of the class we want properties for.
  • ?uri mandatory: the uri of the property
  • ?range optional: range of the property (e.g. Integer, Organization, ...)
  • ?type optional: type of the property (e.g. Integer, ObjectProperty, ...)
  • ?label & ?label_loc optional: contain the label of the class and it's language
  • ?comment & ?comment_loc optional: contain the comment for a class and it's language

Defaults to:

<%uri%> (rdfs:subClassOf|(owl:equivalentClass|^owl:equivalentClass))* ?class .
?uri rdfs:domain ?class .
OPTIONAL { ?uri rdfs:range ?range }  .
OPTIONAL { ?uri rdf:type ?type }  .
OPTIONAL { ?uri rdfs:label ?label . BIND(LANG(?label) AS ?label_loc) } .
OPTIONAL { ?uri rdfs:comment ?comment . BIND(LANG(?comment) AS ?comment_loc) } .
FILTER ( !isBlank(?class) && !isBlank(?uri) && !isBlank(?range) )

getInverseProperties

Loads all inverse properties of a class, once a class is added to the workspace. For example Company : Employee : Person. Contains the query parameters:

  • <%uri%> mandatory: Will be replaced with the uri of the class we want properties for.
  • ?uri mandatory: the uri of the property
  • ?range optional: range of the property (e.g. Integer, Organization, ...)
  • ?type optional: type of the property (e.g. Integer, ObjectProperty, ...)
  • ?label & ?label_loc optional: contain the label of the class and it's language
  • ?comment & ?comment_loc optional: contain the comment for a class and it's language

Defaults to:

<%uri%> (rdfs:subClassOf|(owl:equivalentClass|^owl:equivalentClass))* ?class .
?uri rdfs:range ?class .
OPTIONAL { ?uri rdfs:range ?range }  .
OPTIONAL { ?uri rdf:type ?type }  .
OPTIONAL { ?uri rdfs:label ?label . BIND(LANG(?label) AS ?label_loc) } .
OPTIONAL { ?uri rdfs:comment ?comment . BIND(LANG(?comment) AS ?comment_loc) } .
FILTER ( !isBlank(?class) && !isBlank(?uri) && !isBlank(?range) )

getSuperAndEqClasses

Loads all super and equivalent classes of a class once this class is added to the workspace. Contains the query parameters:

  • <%uri%> mandatory: Will be replaced with the uri of the class.
  • ?uri mandatory: the uri of super & equivalent classes

Defaults to:

<%uri%> (rdfs:subClassOf|(owl:equivalentClass|^owl:equivalentClass))* ?uri
FILTER ( !isBlank(?uri) )

getSubAndEqClasses

Loads all sub and equivalent classes of a range of a property, once this property is added to a subject. Contains the query parameters:

  • <%uri%> mandatory: Will be replaced with the uri of the property range.
  • ?uri mandatory: the uri of sub & equivalent classes

Defaults to:

<%uri%> (^rdfs:subClassOf|(owl:equivalentClass|^owl:equivalentClass))* ?uri
FILTER ( !isBlank(?uri) )

prefixes

Prefixes used in meta and result queries. Defaults to:

    globalConfig.prefixes = {
        'rdfs': 'http://www.w3.org/2000/01/rdf-schema#',
        'foaf': 'http://xmlns.com/foaf/0.1/',
        'owl': 'http://www.w3.org/2002/07/owl#',
        'vsb': 'http://vsb.leipert.io/ns/'
    }

If you don't want to overwrite the default prefixes, you simply can add some using lodash's merge:

    globalConfig.prefixes = _.merge(globalConfig.prefixes,{
        bibrm: 'http://vocab.ub.uni-leipzig.de/bibrm/'
    });

propertyTypeByRange

Mapping from the range of a property to an internal property type. Defaults to

    globalConfig.propertyTypeByRange = {
      'http://vsb.leipert.io/ns/': 'OBJECT_PROPERTY',
      'http://xmlns.com/foaf/0.1/': 'OBJECT_PROPERTY',
      'http://www.w3.org/2001/XMLSchema#(integer|float|double|decimal|positiveInteger|nonNegativeInteger)': 'NUMBER_PROPERTY',
      'http://www.w3.org/2001/XMLSchema#(string|literal)': 'STRING_PROPERTY',
      'http://www.w3.org/2001/XMLSchema#date': 'DATE_PROPERTY'
    }

propertyTypeByType

Mapping from the property type to an internal property type. Defaults to

    globalConfig.propertyTypeByType = {
      'http://www.w3.org/2002/07/owl#ObjectProperty': 'OBJECT_PROPERTY'
    }