Skip to content
Browse files

Merge pull request #140 from wimleers/fix-trailing-whitespace

Fix trailing whitespace.
  • Loading branch information...
2 parents 10ec089 + 083d124 commit 81bc88eccedb412294a7bd08361ea756a563cb25 @bergie committed
View
66 src/Able.js
@@ -9,7 +9,7 @@
// ## VIE.Able
// VIE implements asynchronius service methods through
// [jQuery.Deferred](http://api.jquery.com/category/deferred-object/) objects.
-// Loadable, Analysable, Savable, etc. are part of the VIE service API and
+// Loadable, Analysable, Savable, etc. are part of the VIE service API and
// are implemented with the generic VIE.Able class.
// Example:
//
@@ -18,7 +18,7 @@
// };
// VIE.prototype.Loadable.prototype = new VIE.prototype.Able();
//
-// This defines
+// This defines
//
// someVIEService.load(options)
// .using(...)
@@ -30,13 +30,13 @@
// ### VIE.Able()
// This is the constructor of a VIE.Able. This should not be called
-// globally but using the inherited classes below.
-// **Parameters**:
-// *nothing*
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{VIE.Able}* : A **new** VIE.Able object.
+// globally but using the inherited classes below.
+// **Parameters**:
+// *nothing*
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{VIE.Able}* : A **new** VIE.Able object.
// Example:
//
// VIE.prototype.Loadable = function (options) {
@@ -47,14 +47,14 @@ VIE.prototype.Able = function(){
// ### init(options, methodName)
// Internal method, called during initialization.
-// **Parameters**:
+// **Parameters**:
// *{object}* **options** the *able* options coming from the API call
// *{string}* **methodName** the service method called on `.execute`.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{VIE.Able}* : The current instance.
-// **Example usage**:
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{VIE.Able}* : The current instance.
+// **Example usage**:
//
// VIE.prototype.Loadable = function (options) {
// this.init(options,"load");
@@ -71,7 +71,7 @@ VIE.prototype.Able = function(){
this.deferred = jQuery.Deferred();
// In order to get more information and documentation about the passed-through
-// deferred methods and their synonyms, please see the documentation of
+// deferred methods and their synonyms, please see the documentation of
// the [jQuery.Deferred object](http://api.jquery.com/category/deferred-object/)
/* Public deferred-methods */
this.resolve = this.deferred.resolve;
@@ -90,14 +90,14 @@ VIE.prototype.Able = function(){
// ### using(services)
-// This method registers services with the current able instance.
-// **Parameters**:
-// *{string|array}* **services** An id of a service or an array of strings.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{VIE.Able}* : The current instance.
-// **Example usage**:
+// This method registers services with the current able instance.
+// **Parameters**:
+// *{string|array}* **services** An id of a service or an array of strings.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{VIE.Able}* : The current instance.
+// **Example usage**:
//
// var loadable = vie.load({id: "http://example.com/entity/1234"});
// able.using("myService");
@@ -110,16 +110,16 @@ VIE.prototype.Able = function(){
});
return this;
};
-
+
// ### execute()
-// This method runs the actual method on all registered services.
-// **Parameters**:
-// *nothing*
-// **Throws**:
-// *nothing* ...
-// **Returns**:
-// *{VIE.Able}* : The current instance.
-// **Example usage**:
+// This method runs the actual method on all registered services.
+// **Parameters**:
+// *nothing*
+// **Throws**:
+// *nothing* ...
+// **Returns**:
+// *{VIE.Able}* : The current instance.
+// **Example usage**:
//
// var able = new vie.Able().init();
// able.using("stanbol")
View
262 src/Attribute.js
@@ -19,24 +19,24 @@ if (VIE.prototype.Attributes) {
}
// ### VIE.Attribute(id, range, domain, minCount, maxCount, metadata)
-// This is the constructor of a VIE.Attribute.
-// **Parameters**:
-// *{string}* **id** The id of the attribute.
-// *{string|array}* **range** A string or an array of strings of the target range of
-// the attribute.
-// *{string}* **domain** The domain of the attribute.
-// *{number}* **minCount** The minimal number this attribute can occur. (needs to be >= 0)
+// This is the constructor of a VIE.Attribute.
+// **Parameters**:
+// *{string}* **id** The id of the attribute.
+// *{string|array}* **range** A string or an array of strings of the target range of
+// the attribute.
+// *{string}* **domain** The domain of the attribute.
+// *{number}* **minCount** The minimal number this attribute can occur. (needs to be >= 0)
// *{number}* **maxCount** The maximal number this attribute can occur. (needs to be >= minCount, use `-1` for unlimited)
// *{object}* **metadata** Possible metadata about the attribute
-// **Throws**:
-// *{Error}* if one of the given paramenters is missing.
-// **Returns**:
-// *{VIE.Attribute}* : A **new** VIE.Attribute object.
-// **Example usage**:
+// **Throws**:
+// *{Error}* if one of the given paramenters is missing.
+// **Returns**:
+// *{VIE.Attribute}* : A **new** VIE.Attribute object.
+// **Example usage**:
//
// var knowsAttr = new vie.Attribute("knows", ["Person"], "Person", 0, 10);
// // Creates an attribute to describe a *knows*-relationship
-// // between persons. Each person can only have
+// // between persons. Each person can only have
VIE.prototype.Attribute = function (id, range, domain, minCount, maxCount, metadata) {
if (id === undefined || typeof id !== 'string') {
throw new Error("The attribute constructor needs an 'id' of type string! E.g., 'Person'");
@@ -47,33 +47,33 @@ VIE.prototype.Attribute = function (id, range, domain, minCount, maxCount, metad
if (domain === undefined) {
throw new Error("The attribute constructor of " + id + " needs a 'domain'.");
}
-
+
this._domain = domain;
-
+
// ### id
-// This field stores the id of the attribute's instance.
-// **Parameters**:
+// This field stores the id of the attribute's instance.
+// **Parameters**:
+// nothing
+// **Throws**:
// nothing
-// **Throws**:
-// nothing
-// **Returns**:
-// *{string}* : A URI, representing the id of the attribute.
-// **Example usage**:
+// **Returns**:
+// *{string}* : A URI, representing the id of the attribute.
+// **Example usage**:
//
// var knowsAttr = new vie.Attribute("knows", ["Person"], "Person");
// console.log(knowsAttr.id);
// // --> <http://viejs.org/ns/knows>
this.id = this.vie.namespaces.isUri(id) ? id : this.vie.namespaces.uri(id);
-
+
// ### range
-// This field stores the ranges of the attribute's instance.
-// **Parameters**:
+// This field stores the ranges of the attribute's instance.
+// **Parameters**:
+// nothing
+// **Throws**:
// nothing
-// **Throws**:
-// nothing
-// **Returns**:
-// *{array}* : An array of strings which represent the types.
-// **Example usage**:
+// **Returns**:
+// *{array}* : An array of strings which represent the types.
+// **Example usage**:
//
// var knowsAttr = new vie.Attribute("knows", ["Person"], "Person");
// console.log(knowsAttr.range);
@@ -82,30 +82,30 @@ VIE.prototype.Attribute = function (id, range, domain, minCount, maxCount, metad
// ### min
// This field stores the minimal amount this attribute can occur in the type's instance. The number
-// needs to be greater or equal to zero.
-// **Parameters**:
+// needs to be greater or equal to zero.
+// **Parameters**:
+// nothing
+// **Throws**:
// nothing
-// **Throws**:
-// nothing
-// **Returns**:
-// *{int}* : The minimal amount this attribute can occur.
-// **Example usage**:
+// **Returns**:
+// *{int}* : The minimal amount this attribute can occur.
+// **Example usage**:
//
// console.log(person.min);
// // --> 0
minCount = minCount ? minCount : 0;
this.min = (minCount > 0) ? minCount : 0;
-
+
// ### max
// This field stores the maximal amount this attribute can occur in the type's instance.
-// This number cannot be smaller than min
-// **Parameters**:
+// This number cannot be smaller than min
+// **Parameters**:
+// nothing
+// **Throws**:
// nothing
-// **Throws**:
-// nothing
-// **Returns**:
-// *{int}* : The maximal amount this attribute can occur.
-// **Example usage**:
+// **Returns**:
+// *{int}* : The maximal amount this attribute can occur.
+// **Example usage**:
//
// console.log(person.max);
// // --> 1.7976931348623157e+308
@@ -121,16 +121,16 @@ VIE.prototype.Attribute = function (id, range, domain, minCount, maxCount, metad
// ### applies(range)
// This method checks, whether the current attribute applies in the given range.
-// If ```range``` is a string and cannot be transformed into a ```VIE.Type```,
-// this performs only string comparison, if it is a VIE.Type
+// If ```range``` is a string and cannot be transformed into a ```VIE.Type```,
+// this performs only string comparison, if it is a VIE.Type
// or an ID of a VIE.Type, then inheritance is checked as well.
-// **Parameters**:
-// *{string|VIE.Type}* **range** The ```VIE.Type``` (or it's string representation) to be checked.
-// **Throws**:
-// nothing
-// **Returns**:
-// *{boolean}* : ```true``` if the given type applies to this attribute and ```false``` otherwise.
-// **Example usage**:
+// **Parameters**:
+// *{string|VIE.Type}* **range** The ```VIE.Type``` (or it's string representation) to be checked.
+// **Throws**:
+// nothing
+// **Returns**:
+// *{boolean}* : ```true``` if the given type applies to this attribute and ```false``` otherwise.
+// **Example usage**:
//
// var knowsAttr = new vie.Attribute("knows", ["Person"], "Person");
// console.log(knowsAttr.applies("Person")); // --> true
@@ -154,61 +154,61 @@ VIE.prototype.Attribute = function (id, range, domain, minCount, maxCount, metad
}
return false;
};
-
+
};
// ## VIE.Attributes(domain, attrs)
// This is the constructor of a VIE.Attributes. Basically a convenience class
-// that represents a list of ```VIE.Attribute```. As attributes are part of a
-// certain ```VIE.Type```, it needs to be passed for inheritance checks.
-// **Parameters**:
-// *{string}* **domain** The domain of the attributes (the type they will be part of).
+// that represents a list of ```VIE.Attribute```. As attributes are part of a
+// certain ```VIE.Type```, it needs to be passed for inheritance checks.
+// **Parameters**:
+// *{string}* **domain** The domain of the attributes (the type they will be part of).
// *{string|VIE.Attribute|array}* **attrs** Either a string representation of an attribute,
-// a proper instance of ```VIE.Attribute``` or an array of both.
-// *{string}* **domain** The domain of the attribute.
-// **Throws**:
-// *{Error}* if one of the given paramenters is missing.
-// **Returns**:
-// *{VIE.Attribute}* : A **new** VIE.Attribute instance.
-// **Example usage**:
+// a proper instance of ```VIE.Attribute``` or an array of both.
+// *{string}* **domain** The domain of the attribute.
+// **Throws**:
+// *{Error}* if one of the given paramenters is missing.
+// **Returns**:
+// *{VIE.Attribute}* : A **new** VIE.Attribute instance.
+// **Example usage**:
//
// var knowsAttr = new vie.Attribute("knows", ["Person"], "Person");
// var personAttrs = new vie.Attributes("Person", knowsAttr);
VIE.prototype.Attributes = function (domain, attrs) {
-
+
this._local = {};
this._attributes = {};
-
+
// ### domain
-// This field stores the domain of the attributes' instance.
-// **Parameters**:
+// This field stores the domain of the attributes' instance.
+// **Parameters**:
// nothing
-// **Throws**:
-// nothing
-// **Returns**:
-// *{string}* : The string representation of the domain.
-// **Example usage**:
+// **Throws**:
+// nothing
+// **Returns**:
+// *{string}* : The string representation of the domain.
+// **Example usage**:
//
// console.log(personAttrs.domain);
// // --> ["Person"]
this.domain = domain;
-
+
// ### add(id, range, min, max, metadata)
// This method adds a ```VIE.Attribute``` to the attributes instance.
-// **Parameters**:
+// **Parameters**:
// *{string|VIE.Attribute}* **id** The string representation of an attribute, or a proper
-// instance of a ```VIE.Attribute```.
-// *{string|array}* **range** An array representing the target range of the attribute.
-// *{number}* **min** The minimal amount this attribute can appear.
-// instance of a ```VIE.Attribute```.
-// *{number}* **max** The maximal amount this attribute can appear.
+// instance of a ```VIE.Attribute```.
+// *{string|array}* **range** An array representing the target range of the attribute.
+// *{number}* **min** The minimal amount this attribute can appear.
+// instance of a ```VIE.Attribute```.
+// *{number}* **max** The maximal amount this attribute can appear.
// *{object}* **metadata** Additional metadata for the attribute.
-// **Throws**:
-// *{Error}* If an atribute with the given id is already registered.
-// *{Error}* If the ```id``` parameter is not a string, nor a ```VIE.Type``` instance.
-// **Returns**:
-// *{VIE.Attribute}* : The generated or passed attribute.
-// **Example usage**:
+// **Throws**:
+// *{Error}* If an atribute with the given id is already registered.
+// *{Error}* If the ```id``` parameter is not a string, nor a ```VIE.Type``` instance.
+// **Returns**:
+// *{VIE.Attribute}* : The generated or passed attribute.
+// **Example usage**:
//
// personAttrs.add("name", "Text", 0, 1);
this.add = function (id, range, min, max, metadata) {
@@ -218,7 +218,7 @@ VIE.prototype.Attributes = function (domain, attrs) {
}, this);
return this;
}
-
+
if (this.get(id)) {
throw new Error("Attribute '" + id + "' already registered for domain " + this.domain.id + "!");
} else {
@@ -236,17 +236,17 @@ VIE.prototype.Attributes = function (domain, attrs) {
}
}
};
-
+
// ### remove(id)
// This method removes a ```VIE.Attribute``` from the attributes instance.
-// **Parameters**:
+// **Parameters**:
// *{string|VIE.Attribute}* **id** The string representation of an attribute, or a proper
-// instance of a ```VIE.Attribute```.
-// **Throws**:
+// instance of a ```VIE.Attribute```.
+// **Throws**:
// *{Error}* When the attribute is inherited from a parent ```VIE.Type``` and thus cannot be removed.
-// **Returns**:
-// *{VIE.Attribute}* : The removed attribute.
-// **Example usage**:
+// **Returns**:
+// *{VIE.Attribute}* : The removed attribute.
+// **Example usage**:
//
// personAttrs.remove("knows");
this.remove = function (id) {
@@ -257,17 +257,17 @@ VIE.prototype.Attributes = function (domain, attrs) {
}
throw new Error("The attribute " + id + " is inherited and cannot be removed from the domain " + this.domain.id + "!");
};
-
+
// ### get(id)
-// This method returns a ```VIE.Attribute``` from the attributes instance by it's id.
-// **Parameters**:
+// This method returns a ```VIE.Attribute``` from the attributes instance by it's id.
+// **Parameters**:
// *{string|VIE.Attribute}* **id** The string representation of an attribute, or a proper
-// instance of a ```VIE.Attribute```.
-// **Throws**:
-// *{Error}* When the method is called with an unknown datatype.
-// **Returns**:
-// *{VIE.Attribute}* : The attribute.
-// **Example usage**:
+// instance of a ```VIE.Attribute```.
+// **Throws**:
+// *{Error}* When the method is called with an unknown datatype.
+// **Returns**:
+// *{VIE.Attribute}* : The attribute.
+// **Example usage**:
//
// personAttrs.get("knows");
this.get = function (id) {
@@ -280,35 +280,35 @@ VIE.prototype.Attributes = function (domain, attrs) {
throw new Error("Wrong argument in VIE.Attributes.get()");
}
};
-
+
// ### _inherit()
// The private method ```_inherit``` creates a full list of all attributes. This includes
// local attributes as well as inherited attributes from the parents. The ranges of attributes
// with the same id will be merged. This method is called everytime an attribute is requested or
-// the list of all attributes. Usually this method should not be invoked outside of the class.
-// **Parameters**:
-// *nothing*
-// instance of a ```VIE.Attribute```.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *nothing*
-// **Example usage**:
+// the list of all attributes. Usually this method should not be invoked outside of the class.
+// **Parameters**:
+// *nothing*
+// instance of a ```VIE.Attribute```.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *nothing*
+// **Example usage**:
//
// personAttrs._inherit();
this._inherit = function () {
var a, x, id;
var attributes = jQuery.extend(true, {}, this._local);
-
+
var inherited = _.map(this.domain.supertypes.list(),
function (x) {
- return x.attributes;
+ return x.attributes;
}
);
var add = {};
var merge = {};
- var ilen, alen;
+ var ilen, alen;
for (a = 0, ilen = inherited.length; a < ilen; a++) {
var attrs = inherited[a].list();
for (x = 0, alen = attrs.length; x < alen; x++) {
@@ -340,10 +340,10 @@ VIE.prototype.Attributes = function (domain, attrs) {
}
}
}
-
+
/* adds inherited attributes that do not need to be merged */
jQuery.extend(attributes, add);
-
+
/* merges inherited attributes */
for (id in merge) {
var mranges = merge[id].range;
@@ -371,7 +371,7 @@ VIE.prototype.Attributes = function (domain, attrs) {
ranges.push(mranges[r]);
}
}
-
+
var maxMin = _.max(mins);
var minMax = _.min(maxs);
if (maxMin <= minMax && minMax >= 0 && maxMin >= 0) {
@@ -386,14 +386,14 @@ VIE.prototype.Attributes = function (domain, attrs) {
};
// ### toArray() === list()
-// This method return an array of ```VIE.Attribute```s from the attributes instance.
-// **Parameters**:
-// *nothing.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{array}* : An array of ```VIE.Attribute```.
-// **Example usage**:
+// This method return an array of ```VIE.Attribute```s from the attributes instance.
+// **Parameters**:
+// *nothing.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{array}* : An array of ```VIE.Attribute```.
+// **Example usage**:
//
// personAttrs.list();
this.toArray = this.list = function (range) {
@@ -406,9 +406,9 @@ VIE.prototype.Attributes = function (domain, attrs) {
}
return ret;
};
-
+
attrs = _.isArray(attrs) ? attrs : [ attrs ];
- _.each(attrs, function (attr) {
+ _.each(attrs, function (attr) {
this.add(attr.id, attr.range, attr.min, attr.max, attr.metadata);
}, this);
};
View
14 src/Collection.js
@@ -19,13 +19,13 @@ VIE.prototype.Collection = Backbone.Collection.extend({
canAdd: function (type) {
return true;
},
-
+
get: function(id) {
if (id === null) {
return null;
}
-
- id = (id.getSubject)? id.getSubject() : id;
+
+ id = (id.getSubject)? id.getSubject() : id;
if (typeof id === "string" && id.indexOf("_:") === 0) {
if (id.indexOf("bnode") === 2) {
//bnode!
@@ -103,7 +103,7 @@ VIE.prototype.Collection = Backbone.Collection.extend({
if (options.overrideAttributes) {
newAttribs[attribute] = value;
return true;
- }
+ }
if (attribute === '@context') {
newAttribs[attribute] = jQuery.extend(true, {}, oldVals, newVals);
} else {
@@ -130,20 +130,20 @@ VIE.prototype.Collection = Backbone.Collection.extend({
}
return false;
},
-
+
toReference: function(uri){
if (this.isReference(uri)) {
return uri;
}
return '<' + uri + '>';
},
-
+
fromReference: function(uri){
if (!this.isReference(uri)) {
return uri;
}
return uri.substring(1, uri.length - 1);
},
-
+
isCollection: true
});
View
50 src/Entity.js
@@ -7,22 +7,22 @@
// http://viejs.org/
// ## VIE Entities
-//
+//
// In VIE there are two low-level model types for storing data.
// **Collections** and **Entities**. Considering `var v = new VIE();` a VIE instance,
-// `v.entities` is a Collection with `VIE Entity` objects in it.
+// `v.entities` is a Collection with `VIE Entity` objects in it.
// VIE internally uses JSON-LD to store entities.
//
// Each Entity has a few special attributes starting with an `@`. VIE has an API
-// for correctly using these attributes, so in order to stay compatible with later
+// for correctly using these attributes, so in order to stay compatible with later
// versions of the library, possibly using a later version of JSON-LD, use the API
// to interact with your entities.
-//
-// * `@subject` stands for the identifier of the entity. Use `e.getSubject()`
+//
+// * `@subject` stands for the identifier of the entity. Use `e.getSubject()`
// * `@type` stores the explicit entity types. VIE internally handles Type hierarchy,
-// which basically enables to define subtypes and supertypes. Every entity has
+// which basically enables to define subtypes and supertypes. Every entity has
// the type 'owl:Thing'. Read more about Types in <a href="Type.html">VIE.Type</a>.
-// * `@context` stores namespace definitions used in the entity. Read more about
+// * `@context` stores namespace definitions used in the entity. Read more about
// Namespaces in <a href="Namespace.html">VIE Namespaces</a>.
VIE.prototype.Entity = function(attrs, opts) {
@@ -105,7 +105,7 @@ VIE.prototype.Entity = function(attrs, opts) {
},
// #### `.has(attr)`
- // Sometimes you'd like to determine if a specific attribute is set
+ // Sometimes you'd like to determine if a specific attribute is set
// in an entity. For this reason you can call for example `person.has('friend')`
// to determine if a person entity has friends.
has: function(attr) {
@@ -113,11 +113,11 @@ VIE.prototype.Entity = function(attrs, opts) {
return Backbone.Model.prototype.has.call(this, attr);
},
- // #### `.set(attrName, value, opts)`,
+ // #### `.set(attrName, value, opts)`,
// The `options` parameter always refers to a `Backbone.Model.set` `options` object.
//
// **`.set(attributes, options)`** is the most universal way of calling the
- // `.set` method. In this case the `attributes` object is a map of all
+ // `.set` method. In this case the `attributes` object is a map of all
// attributes to be changed.
set : function(attrs, options, opts) {
if (!attrs) {
@@ -128,14 +128,14 @@ VIE.prototype.Entity = function(attrs, opts) {
attrs['@subject'] = this.toReference(attrs['@subject']);
}
- // Use **`.set(attrName, value, options)`** for setting or changing exactly one
+ // Use **`.set(attrName, value, options)`** for setting or changing exactly one
// entity attribute.
if (typeof attrs === "string") {
var obj = {};
obj[attrs] = options;
return this.set(obj, opts);
}
- // **`.set(entity)`**: In case you'd pass a VIE entity,
+ // **`.set(entity)`**: In case you'd pass a VIE entity,
// the passed entities attributes are being set for the entity.
if (attrs.attributes) {
attrs = attrs.attributes;
@@ -150,7 +150,7 @@ VIE.prototype.Entity = function(attrs, opts) {
attrs[newKey] = value;
}
}, this);
- // Finally iterate through the *attributes* to be set and prepare
+ // Finally iterate through the *attributes* to be set and prepare
// them for the Backbone.Model.set method.
_.each (attrs, function (value, key) {
if (!value) { return; }
@@ -180,7 +180,7 @@ VIE.prototype.Entity = function(attrs, opts) {
var child = new self.vie.Entity(value, options);
// which is being stored in `v.entities`
self.vie.entities.addOrUpdate(child);
- // and set as VIE Collection attribute on the original entity
+ // and set as VIE Collection attribute on the original entity
coll = new self.vie.Collection(value, {
vie: self.vie,
predicate: key
@@ -406,11 +406,11 @@ VIE.prototype.Entity = function(attrs, opts) {
return instanceLD;
},
- // **`.setOrAdd(arg1, arg2)`** similar to `.set(..)`, `.setOrAdd(..)` can
+ // **`.setOrAdd(arg1, arg2)`** similar to `.set(..)`, `.setOrAdd(..)` can
// be used for setting one or more attributes of an entity, but in
// this case it's a collection of values, not just one. That means, if the
// entity already has the attribute set, make the value to a VIE Collection
- // and use the collection as value. The collection can contain entities
+ // and use the collection as value. The collection can contain entities
// or literals, but not both at the same time.
setOrAdd: function (arg1, arg2, option) {
var entity = this;
@@ -432,30 +432,30 @@ VIE.prototype.Entity = function(attrs, opts) {
/* attr is always of type string */
/* value can be of type: string,int,double,object,VIE.Entity,VIE.Collection */
/* val can be of type: undefined,string,int,double,array,VIE.Collection */
-
+
/* depending on the type of value and the type of val, different actions need to be made */
_setOrAddOne: function (attr, value, options) {
if (!attr || !value)
return;
options = (options)? options : {};
var v;
-
+
attr = VIE.Util.mapAttributeNS(attr, self.vie.namespaces);
-
+
if (_.isArray(value)) {
for (v = 0; v < value.length; v++) {
this._setOrAddOne(attr, value[v], options);
}
return;
}
-
+
if (attr === "@type" && value instanceof self.vie.Type) {
value = value.id;
}
-
+
var obj = {};
var existing = Backbone.Model.prototype.get.call(this, attr);
-
+
if (!existing) {
obj[attr] = value;
this.set(obj, options);
@@ -518,17 +518,17 @@ VIE.prototype.Entity = function(attrs, opts) {
}
},
- // **`.isof(type)`** determines if the entity is of `type` by explicit or implicit
+ // **`.isof(type)`** determines if the entity is of `type` by explicit or implicit
// declaration. E.g. if Employee is a subtype of Person and e Entity has
// explicitly set type Employee, e.isof(Person) will evaluate to true.
isof: function (type) {
var types = this.get('@type');
-
+
if (types === undefined) {
return false;
}
types = (_.isArray(types))? types : [ types ];
-
+
type = (self.vie.types.get(type))? self.vie.types.get(type) : new self.vie.Type(type);
for (var t = 0; t < types.length; t++) {
if (self.vie.types.get(types[t])) {
View
336 src/Namespace.js
@@ -6,7 +6,7 @@
// For all details and documentation:
// http://viejs.org/
if (VIE.prototype.Namespaces) {
- throw new Error("ERROR: VIE.Namespaces is already defined. " +
+ throw new Error("ERROR: VIE.Namespaces is already defined. " +
"Please check your VIE installation!");
}
@@ -18,7 +18,7 @@ if (VIE.prototype.Namespaces) {
// tend to make their usage pretty circuitous. The ``VIE.Namespaces(...)`` class provides VIE
// with methods to maintain abbreviations (akak **prefixes**) for namespaces in order to
// alleviate their usage. By default, every VIE instance is equipped with a main instance
-// of the namespaces in ``myVIE.namespaces``. Furthermore, VIE uses a **base namespace**,
+// of the namespaces in ``myVIE.namespaces``. Furthermore, VIE uses a **base namespace**,
// which is used if no prefix is given (has an empty prefix).
// In the upcoming sections, we will explain the
// methods to add, access and remove prefixes.
@@ -26,34 +26,34 @@ if (VIE.prototype.Namespaces) {
// ## VIE.Namespaces(base, namespaces)
-// This is the constructor of a VIE.Namespaces. The constructor initially
-// needs a *base namespace* and can optionally be initialised with an
+// This is the constructor of a VIE.Namespaces. The constructor initially
+// needs a *base namespace* and can optionally be initialised with an
// associative array of prefixes and namespaces. The base namespace is used in a way
-// that every non-prefixed, non-expanded attribute or type is assumed to be of that
-// namespace. This helps, e.g., in an environment where only one namespace is given.
-// **Parameters**:
-// *{string}* **base** The base namespace.
-// *{object}* **namespaces** Initial namespaces to bootstrap the namespaces. (optional)
-// **Throws**:
-// *{Error}* if the base namespace is missing.
-// **Returns**:
-// *{VIE.Attribute}* : A **new** VIE.Attribute object.
-// **Example usage**:
+// that every non-prefixed, non-expanded attribute or type is assumed to be of that
+// namespace. This helps, e.g., in an environment where only one namespace is given.
+// **Parameters**:
+// *{string}* **base** The base namespace.
+// *{object}* **namespaces** Initial namespaces to bootstrap the namespaces. (optional)
+// **Throws**:
+// *{Error}* if the base namespace is missing.
+// **Returns**:
+// *{VIE.Attribute}* : A **new** VIE.Attribute object.
+// **Example usage**:
//
-// var ns = new myVIE.Namespaces("http://viejs.org/ns/",
+// var ns = new myVIE.Namespaces("http://viejs.org/ns/",
// {
// "foaf": "http://xmlns.com/foaf/0.1/"
// });
VIE.prototype.Namespaces = function (base, namespaces) {
-
+
if (!base) {
throw new Error("Please provide a base namespace!");
}
this._base = base;
-
+
this._namespaces = (namespaces)? namespaces : {};
if (typeof this._namespaces !== "object" || _.isArray(this._namespaces)) {
- throw new Error("If you want to initialise VIE namespace prefixes, " +
+ throw new Error("If you want to initialise VIE namespace prefixes, " +
"please provide a proper object!");
}
};
@@ -66,21 +66,21 @@ VIE.prototype.Namespaces = function (base, namespaces) {
// with a string, e.g., ``base("http://viejs.org/ns/");``
// it sets the current base namespace and retuns the namespace object
// for the purpose of chaining. If provided with anything except a string,
-// it throws an Error.
-// **Parameters**:
-// *{string}* **ns** The namespace to be set. (optional)
-// **Throws**:
-// *{Error}* if the namespace is not of type string.
-// **Returns**:
-// *{string}* : The current base namespace.
-// **Example usage**:
+// it throws an Error.
+// **Parameters**:
+// *{string}* **ns** The namespace to be set. (optional)
+// **Throws**:
+// *{Error}* if the namespace is not of type string.
+// **Returns**:
+// *{string}* : The current base namespace.
+// **Example usage**:
//
// var namespaces = new vie.Namespaces("http://base.ns/");
// console.log(namespaces.base()); // <-- "http://base.ns/"
// namespaces.base("http://viejs.org/ns/");
// console.log(namespaces.base()); // <-- "http://viejs.org/ns/"
VIE.prototype.Namespaces.prototype.base = function (ns) {
- if (!ns) {
+ if (!ns) {
return this._base;
}
else if (typeof ns === "string") {
@@ -96,19 +96,19 @@ VIE.prototype.Namespaces.prototype.base = function (ns) {
// ### add(prefix, namespace)
// This method adds new prefix mappings to the
// current instance. If a prefix or a namespace is already
-// present (in order to avoid ambiguities), an Error is thrown.
-// ``prefix`` can also be an object in which case, the method
-// is called sequentially on all elements.
-// **Parameters**:
+// present (in order to avoid ambiguities), an Error is thrown.
+// ``prefix`` can also be an object in which case, the method
+// is called sequentially on all elements.
+// **Parameters**:
// *{string|object}* **prefix** The prefix to be set. If it is an object, the
-// method will be applied to all key,value pairs sequentially.
-// *{string}* **namespace** The namespace to be set.
-// **Throws**:
+// method will be applied to all key,value pairs sequentially.
+// *{string}* **namespace** The namespace to be set.
+// **Throws**:
// *{Error}* If a prefix or a namespace is already
-// present (in order to avoid ambiguities).
-// **Returns**:
-// *{VIE.Namespaces}* : The current namespaces instance.
-// **Example usage**:
+// present (in order to avoid ambiguities).
+// **Returns**:
+// *{VIE.Namespaces}* : The current namespaces instance.
+// **Example usage**:
//
// var namespaces = new vie.Namespaces("http://base.ns/");
// namespaces.add("", "http://...");
@@ -141,19 +141,19 @@ VIE.prototype.Namespaces.prototype.add = function (prefix, namespace) {
this._namespaces[prefix] = namespace;
return this;
};
-
+
// ### addOrReplace(prefix, namespace)
// This method adds new prefix mappings to the
-// current instance. This will overwrite existing mappings.
-// **Parameters**:
+// current instance. This will overwrite existing mappings.
+// **Parameters**:
// *{string|object}* **prefix** The prefix to be set. If it is an object, the
-// method will be applied to all key,value pairs sequentially.
-// *{string}* **namespace** The namespace to be set.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{VIE.Namespaces}* : The current namespaces instance.
-// **Example usage**:
+// method will be applied to all key,value pairs sequentially.
+// *{string}* **namespace** The namespace to be set.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{VIE.Namespaces}* : The current namespaces instance.
+// **Example usage**:
//
// var namespaces = new vie.Namespaces("http://base.ns/");
// namespaces.addOrReplace("", "http://...");
@@ -173,14 +173,14 @@ VIE.prototype.Namespaces.prototype.addOrReplace = function (prefix, namespace) {
// ### get(prefix)
// This method retrieves a namespaces, given a prefix. If the
-// prefix is the empty string, the base namespace is returned.
-// **Parameters**:
-// *{string}* **prefix** The prefix to be retrieved.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{string|undefined}* : The namespace or ```undefined``` if no namespace could be found.
-// **Example usage**:
+// prefix is the empty string, the base namespace is returned.
+// **Parameters**:
+// *{string}* **prefix** The prefix to be retrieved.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{string|undefined}* : The namespace or ```undefined``` if no namespace could be found.
+// **Example usage**:
//
// var namespaces = new vie.Namespaces("http://base.ns/");
// namespaces.addOrReplace("test", "http://test.ns");
@@ -193,14 +193,14 @@ VIE.prototype.Namespaces.prototype.get = function (prefix) {
};
// ### getPrefix(namespace)
-// This method retrieves a prefix, given a namespace.
-// **Parameters**:
-// *{string}* **namespace** The namespace to be retrieved.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{string|undefined}* : The prefix or ```undefined``` if no prefix could be found.
-// **Example usage**:
+// This method retrieves a prefix, given a namespace.
+// **Parameters**:
+// *{string}* **namespace** The namespace to be retrieved.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{string|undefined}* : The prefix or ```undefined``` if no prefix could be found.
+// **Example usage**:
//
// var namespaces = new vie.Namespaces("http://base.ns/");
// namespaces.addOrReplace("test", "http://test.ns");
@@ -223,14 +223,14 @@ VIE.prototype.Namespaces.prototype.getPrefix = function (namespace) {
};
// ### contains(prefix)
-// This method checks, whether a prefix is stored in the instance.
-// **Parameters**:
-// *{string}* **prefix** The prefix to be checked.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{boolean}* : ```true``` if the prefix could be found, ```false``` otherwise.
-// **Example usage**:
+// This method checks, whether a prefix is stored in the instance.
+// **Parameters**:
+// *{string}* **prefix** The prefix to be checked.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{boolean}* : ```true``` if the prefix could be found, ```false``` otherwise.
+// **Example usage**:
//
// var namespaces = new vie.Namespaces("http://base.ns/");
// namespaces.addOrReplace("test", "http://test.ns");
@@ -240,14 +240,14 @@ VIE.prototype.Namespaces.prototype.contains = function (prefix) {
};
// ### containsNamespace(namespace)
-// This method checks, whether a namespace is stored in the instance.
-// **Parameters**:
-// *{string}* **namespace** The namespace to be checked.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{boolean}* : ```true``` if the namespace could be found, ```false``` otherwise.
-// **Example usage**:
+// This method checks, whether a namespace is stored in the instance.
+// **Parameters**:
+// *{string}* **namespace** The namespace to be checked.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{boolean}* : ```true``` if the namespace could be found, ```false``` otherwise.
+// **Example usage**:
//
// var namespaces = new vie.Namespaces("http://base.ns/");
// namespaces.addOrReplace("test", "http://test.ns");
@@ -257,17 +257,17 @@ VIE.prototype.Namespaces.prototype.containsNamespace = function (namespace) {
};
// ### update(prefix, namespace)
-// This method overwrites the namespace that is stored under the
-// prefix ``prefix`` with the new namespace ``namespace``.
+// This method overwrites the namespace that is stored under the
+// prefix ``prefix`` with the new namespace ``namespace``.
// If a namespace is already bound to another prefix, an Error is thrown.
-// **Parameters**:
-// *{string}* **prefix** The prefix.
-// *{string}* **namespace** The namespace.
-// **Throws**:
-// *{Error}* If a namespace is already bound to another prefix.
-// **Returns**:
-// *{VIE.Namespaces}* : The namespace instance.
-// **Example usage**:
+// **Parameters**:
+// *{string}* **prefix** The prefix.
+// *{string}* **namespace** The namespace.
+// **Throws**:
+// *{Error}* If a namespace is already bound to another prefix.
+// **Returns**:
+// *{VIE.Namespaces}* : The namespace instance.
+// **Example usage**:
//
// ...
VIE.prototype.Namespaces.prototype.update = function (prefix, namespace) {
@@ -276,17 +276,17 @@ VIE.prototype.Namespaces.prototype.update = function (prefix, namespace) {
};
// ### updateNamespace(prefix, namespace)
-// This method overwrites the prefix that is bound to the
+// This method overwrites the prefix that is bound to the
// namespace ``namespace`` with the new prefix ``prefix``. If another namespace is
-// already registered with the given ``prefix``, an Error is thrown.
-// **Parameters**:
-// *{string}* **prefix** The prefix.
-// *{string}* **namespace** The namespace.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{VIE.Namespaces}* : The namespace instance.
-// **Example usage**:
+// already registered with the given ``prefix``, an Error is thrown.
+// **Parameters**:
+// *{string}* **prefix** The prefix.
+// *{string}* **namespace** The namespace.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{VIE.Namespaces}* : The namespace instance.
+// **Example usage**:
//
// var namespaces = new vie.Namespaces("http://base.ns/");
// namespaces.add("test", "http://test.ns");
@@ -298,14 +298,14 @@ VIE.prototype.Namespaces.prototype.updateNamespace = function (prefix, namespace
};
// ### remove(prefix)
-// This method removes the namespace that is stored under the prefix ``prefix``.
-// **Parameters**:
-// *{string}* **prefix** The prefix to be removed.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{VIE.Namespaces}* : The namespace instance.
-// **Example usage**:
+// This method removes the namespace that is stored under the prefix ``prefix``.
+// **Parameters**:
+// *{string}* **prefix** The prefix to be removed.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{VIE.Namespaces}* : The namespace instance.
+// **Example usage**:
//
// var namespaces = new vie.Namespaces("http://base.ns/");
// namespaces.add("test", "http://test.ns");
@@ -320,14 +320,14 @@ VIE.prototype.Namespaces.prototype.remove = function (prefix) {
};
// ### removeNamespace(namespace)
-// This method removes removes the namespace ``namespace`` from the instance.
-// **Parameters**:
-// *{string}* **namespace** The namespace to be removed.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{VIE.Namespaces}* : The namespace instance.
-// **Example usage**:
+// This method removes removes the namespace ``namespace`` from the instance.
+// **Parameters**:
+// *{string}* **namespace** The namespace to be removed.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{VIE.Namespaces}* : The namespace instance.
+// **Example usage**:
//
// var namespaces = new vie.Namespaces("http://base.ns/");
// namespaces.add("test", "http://test.ns");
@@ -345,21 +345,21 @@ VIE.prototype.Namespaces.prototype.removeNamespace = function (namespace) {
// ### toObj()
// This method serializes the namespace instance into an associative
// array representation. The base namespace is given an empty
-// string as key.
-// **Parameters**:
-// *{boolean}* **omitBase** If set to ```true``` this omits the baseNamespace.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{object}* : A serialization of the namespaces as an object.
-// **Example usage**:
+// string as key.
+// **Parameters**:
+// *{boolean}* **omitBase** If set to ```true``` this omits the baseNamespace.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{object}* : A serialization of the namespaces as an object.
+// **Example usage**:
//
// var namespaces = new vie.Namespaces("http://base.ns/");
// namespaces.add("test", "http://test.ns");
-// console.log(namespaces.toObj());
-// // <-- {"" : "http://base.ns/",
+// console.log(namespaces.toObj());
+// // <-- {"" : "http://base.ns/",
// "test": "http://test.ns"}
-// console.log(namespaces.toObj(true));
+// console.log(namespaces.toObj(true));
// // <-- {"test": "http://test.ns"}
VIE.prototype.Namespaces.prototype.toObj = function (omitBase) {
if (omitBase) {
@@ -369,21 +369,21 @@ VIE.prototype.Namespaces.prototype.toObj = function (omitBase) {
};
// ### curie(uri, safe)
-// This method converts a given
+// This method converts a given
// URI into a CURIE (or SCURIE), based on the given ```VIE.Namespaces``` object.
// If the given uri is already a URI, it is left untouched and directly returned.
-// If no prefix could be found, an ```Error``` is thrown.
-// **Parameters**:
-// *{string}* **uri** The URI to be transformed.
-// *{boolean}* **safe** A flag whether to generate CURIEs or SCURIEs.
-// **Throws**:
-// *{Error}* If no prefix could be found in the passed namespaces.
-// **Returns**:
-// *{string}* The CURIE or SCURIE.
-// **Example usage**:
+// If no prefix could be found, an ```Error``` is thrown.
+// **Parameters**:
+// *{string}* **uri** The URI to be transformed.
+// *{boolean}* **safe** A flag whether to generate CURIEs or SCURIEs.
+// **Throws**:
+// *{Error}* If no prefix could be found in the passed namespaces.
+// **Returns**:
+// *{string}* The CURIE or SCURIE.
+// **Example usage**:
//
// var ns = new myVIE.Namespaces(
-// "http://viejs.org/ns/",
+// "http://viejs.org/ns/",
// { "dbp": "http://dbpedia.org/ontology/" }
// );
// var uri = "<http://dbpedia.org/ontology/Person>";
@@ -394,18 +394,18 @@ VIE.prototype.Namespaces.prototype.curie = function(uri, safe){
};
// ### isCurie(curie)
-// This method checks, whether
-// the given string is a CURIE and returns ```true``` if so and ```false```otherwise.
-// **Parameters**:
-// *{string}* **curie** The CURIE (or SCURIE) to be checked.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{boolean}* ```true``` if the given curie is a CURIE or SCURIE and ```false``` otherwise.
-// **Example usage**:
+// This method checks, whether
+// the given string is a CURIE and returns ```true``` if so and ```false```otherwise.
+// **Parameters**:
+// *{string}* **curie** The CURIE (or SCURIE) to be checked.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{boolean}* ```true``` if the given curie is a CURIE or SCURIE and ```false``` otherwise.
+// **Example usage**:
//
// var ns = new myVIE.Namespaces(
-// "http://viejs.org/ns/",
+// "http://viejs.org/ns/",
// { "dbp": "http://dbpedia.org/ontology/" }
// );
// var uri = "<http://dbpedia.org/ontology/Person>";
@@ -419,25 +419,25 @@ VIE.prototype.Namespaces.prototype.curie = function(uri, safe){
VIE.prototype.Namespaces.prototype.isCurie = function (something) {
return VIE.Util.isCurie(something, this);
};
-
+
// ### uri(curie)
-// This method converts a
-// given CURIE (or save CURIE) into a URI, based on the given ```VIE.Namespaces``` object.
-// **Parameters**:
-// *{string}* **curie** The CURIE to be transformed.
-// **Throws**:
-// *{Error}* If no URI could be assembled.
-// **Returns**:
-// *{string}* : A string, representing the URI.
-// **Example usage**:
+// This method converts a
+// given CURIE (or save CURIE) into a URI, based on the given ```VIE.Namespaces``` object.
+// **Parameters**:
+// *{string}* **curie** The CURIE to be transformed.
+// **Throws**:
+// *{Error}* If no URI could be assembled.
+// **Returns**:
+// *{string}* : A string, representing the URI.
+// **Example usage**:
//
// var ns = new myVIE.Namespaces(
-// "http://viejs.org/ns/",
+// "http://viejs.org/ns/",
// { "dbp": "http://dbpedia.org/ontology/" }
// );
// var curie = "dbp:Person";
// var scurie = "[dbp:Person]";
-// ns.uri(curie);
+// ns.uri(curie);
// --> <http://dbpedia.org/ontology/Person>
// ns.uri(scurie);
// --> <http://dbpedia.org/ontology/Person>
@@ -446,14 +446,14 @@ VIE.prototype.Namespaces.prototype.uri = function (curie) {
};
// ### isUri(something)
-// This method checks, whether the given string is a URI.
-// **Parameters**:
-// *{string}* **something** : The string to be checked.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{boolean}* : ```true``` if the string is a URI, ```false``` otherwise.
-// **Example usage**:
+// This method checks, whether the given string is a URI.
+// **Parameters**:
+// *{string}* **something** : The string to be checked.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{boolean}* : ```true``` if the string is a URI, ```false``` otherwise.
+// **Example usage**:
//
// var namespaces = new vie.Namespaces("http://base.ns/");
// namespaces.addOrReplace("test", "http://test.ns");
View
348 src/Type.js
@@ -9,7 +9,7 @@
// ## VIE.Types
// Within VIE, we provide special capabilities of handling types of entites. This helps
-// for example to query easily for certain entities (e.g., you only need to query for *Person*s
+// for example to query easily for certain entities (e.g., you only need to query for *Person*s
// and not for all subtypes).
if (VIE.prototype.Type) {
throw new Error("ERROR: VIE.Type is already defined. Please check your installation!");
@@ -19,17 +19,17 @@ if (VIE.prototype.Types) {
}
// ### VIE.Type(id, attrs, metadata)
-// This is the constructor of a VIE.Type.
-// **Parameters**:
-// *{string}* **id** The id of the type.
-// *{string|array|VIE.Attribute}* **attrs** A string, proper ```VIE.Attribute``` or an array of these which
+// This is the constructor of a VIE.Type.
+// **Parameters**:
+// *{string}* **id** The id of the type.
+// *{string|array|VIE.Attribute}* **attrs** A string, proper ```VIE.Attribute``` or an array of these which
// *{object}* **metadata** Possible metadata about the type
-// are the possible attributes of the type
-// **Throws**:
-// *{Error}* if one of the given paramenters is missing.
-// **Returns**:
-// *{VIE.Type}* : A **new** VIE.Type object.
-// **Example usage**:
+// are the possible attributes of the type
+// **Throws**:
+// *{Error}* if one of the given paramenters is missing.
+// **Returns**:
+// *{VIE.Type}* : A **new** VIE.Type object.
+// **Example usage**:
//
// var person = new vie.Type("Person", ["name", "knows"]);
VIE.prototype.Type = function (id, attrs, metadata) {
@@ -38,14 +38,14 @@ VIE.prototype.Type = function (id, attrs, metadata) {
}
// ### id
-// This field stores the id of the type's instance.
-// **Parameters**:
+// This field stores the id of the type's instance.
+// **Parameters**:
// nothing
-// **Throws**:
-// nothing
-// **Returns**:
-// *{string}* : The id of the type as a URI.
-// **Example usage**:
+// **Throws**:
+// nothing
+// **Returns**:
+// *{string}* : The id of the type as a URI.
+// **Example usage**:
//
// console.log(person.id);
// // --> "<http://viejs.org/ns/Person>"
@@ -54,46 +54,46 @@ VIE.prototype.Type = function (id, attrs, metadata) {
/* checks whether such a type is already defined. */
if (this.vie.types.get(this.id)) {
throw new Error("The type " + this.id + " is already defined!");
- }
-
+ }
+
// ### supertypes
// This field stores all parent types of the type's instance. This
-// is set if the current type inherits from another type.
-// **Parameters**:
-// nothing
-// **Throws**:
-// nothing
-// **Returns**:
-// *{VIE.Types}* : The supertypes (parents) of the type.
-// **Example usage**:
+// is set if the current type inherits from another type.
+// **Parameters**:
+// nothing
+// **Throws**:
+// nothing
+// **Returns**:
+// *{VIE.Types}* : The supertypes (parents) of the type.
+// **Example usage**:
//
// console.log(person.supertypes);
this.supertypes = new this.vie.Types();
// ### subtypes
// This field stores all children types of the type's instance. This
-// will be set if another type inherits from the current type.
-// **Parameters**:
-// nothing
-// **Throws**:
-// nothing
-// **Returns**:
-// *{VIE.Types}* : The subtypes (parents) of the type.
-// **Example usage**:
+// will be set if another type inherits from the current type.
+// **Parameters**:
+// nothing
+// **Throws**:
+// nothing
+// **Returns**:
+// *{VIE.Types}* : The subtypes (parents) of the type.
+// **Example usage**:
//
// console.log(person.subtypes);
this.subtypes = new this.vie.Types();
-
+
// ### attributes
// This field stores all attributes of the type's instance as
-// a proper ```VIE.Attributes``` class. (see also <a href="Attribute.html">VIE.Attributes</a>)
-// **Parameters**:
-// nothing
-// **Throws**:
-// nothing
-// **Returns**:
-// *{VIE.Attributes}* : The attributes of the type.
-// **Example usage**:
+// a proper ```VIE.Attributes``` class. (see also <a href="Attribute.html">VIE.Attributes</a>)
+// **Parameters**:
+// nothing
+// **Throws**:
+// nothing
+// **Returns**:
+// *{VIE.Attributes}* : The attributes of the type.
+// **Example usage**:
//
// console.log(person.attributes);
this.attributes = new this.vie.Attributes(this, (attrs)? attrs : []);
@@ -104,17 +104,17 @@ VIE.prototype.Type = function (id, attrs, metadata) {
this.metadata = metadata ? metadata : {};
// ### isof(type)
-// This method checks whether the current type is a child of the given type.
-// **Parameters**:
-// *{string|VIE.Type}* **type** The type (or the id of that type) to be checked.
-// **Throws**:
-// *{Error}* If the type is not valid.
-// **Returns**:
-// *{boolean}* : ```true``` if the current type inherits from the type, ```false``` otherwise.
-// **Example usage**:
+// This method checks whether the current type is a child of the given type.
+// **Parameters**:
+// *{string|VIE.Type}* **type** The type (or the id of that type) to be checked.
+// **Throws**:
+// *{Error}* If the type is not valid.
+// **Returns**:
+// *{boolean}* : ```true``` if the current type inherits from the type, ```false``` otherwise.
+// **Example usage**:
//
// console.log(person.isof("owl:Thing"));
-// // <-- true
+// // <-- true
this.isof = function (type) {
type = this.vie.types.get(type);
if (type) {
@@ -125,14 +125,14 @@ VIE.prototype.Type = function (id, attrs, metadata) {
};
// ### subsumes(type)
-// This method checks whether the current type is a parent of the given type.
-// **Parameters**:
-// *{string|VIE.Type}* **type** The type (or the id of that type) to be checked.
-// **Throws**:
-// *{Error}* If the type is not valid.
-// **Returns**:
-// *{boolean}* : ```true``` if the current type is a parent of the type, ```false``` otherwise.
-// **Example usage**:
+// This method checks whether the current type is a parent of the given type.
+// **Parameters**:
+// *{string|VIE.Type}* **type** The type (or the id of that type) to be checked.
+// **Throws**:
+// *{Error}* If the type is not valid.
+// **Returns**:
+// *{boolean}* : ```true``` if the current type is a parent of the type, ```false``` otherwise.
+// **Example usage**:
//
// var x = new vie.Type(...);
// var y = new vie.Type(...).inherit(x);
@@ -157,18 +157,18 @@ VIE.prototype.Type = function (id, attrs, metadata) {
throw new Error("No valid type given");
}
};
-
+
// ### inherit(supertype)
// This method invokes inheritance throught the types. This adds the current type to the
-// subtypes of the supertype and vice versa.
-// **Parameters**:
+// subtypes of the supertype and vice versa.
+// **Parameters**:
// *{string|VIE.Type|array}* **supertype** The type to be inherited from. If this is an array
-// the inherit method is called sequentially on all types.
-// **Throws**:
-// *{Error}* If the type is not valid.
-// **Returns**:
-// *{VIE.Type}* : The instance itself.
-// **Example usage**:
+// the inherit method is called sequentially on all types.
+// **Throws**:
+// *{Error}* If the type is not valid.
+// **Returns**:
+// *{VIE.Type}* : The instance itself.
+// **Example usage**:
//
// var x = new vie.Type(...);
// var y = new vie.Type(...).inherit(x);
@@ -199,16 +199,16 @@ VIE.prototype.Type = function (id, attrs, metadata) {
}
return this;
};
-
+
// ### hierarchy()
-// This method serializes the hierarchy of child types into an object.
-// **Parameters**:
-// *nothing*
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{object}* : The hierachy of child types as an object.
-// **Example usage**:
+// This method serializes the hierarchy of child types into an object.
+// **Parameters**:
+// *nothing*
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{object}* : The hierachy of child types as an object.
+// **Example usage**:
//
// var x = new vie.Type(...);
// var y = new vie.Type(...).inherit(x);
@@ -222,27 +222,27 @@ VIE.prototype.Type = function (id, attrs, metadata) {
}
return obj;
};
-
+
// ### instance()
// This method creates a ```VIE.Entity``` instance from this type.
-// **Parameters**:
-// *{object}* **attrs** see <a href="Entity.html">constructor of VIE.Entity</a>
-// *{object}* **opts** see <a href="Entity.html">constructor of VIE.Entity</a>
-// **Throws**:
-// *{Error}* if the instance could not be built
-// **Returns**:
-// *{VIE.Entity}* : A **new** instance of a ```VIE.Entity``` with the current type.
-// **Example usage**:
+// **Parameters**:
+// *{object}* **attrs** see <a href="Entity.html">constructor of VIE.Entity</a>
+// *{object}* **opts** see <a href="Entity.html">constructor of VIE.Entity</a>
+// **Throws**:
+// *{Error}* if the instance could not be built
+// **Returns**:
+// *{VIE.Entity}* : A **new** instance of a ```VIE.Entity``` with the current type.
+// **Example usage**:
//
// var person = new vie.Type("person");
// var sebastian = person.instance(
-// {"@subject" : "#me",
+// {"@subject" : "#me",
// "name" : "Sebastian"});
// console.log(sebastian.get("name")); // <-- "Sebastian"
this.instance = function (attrs, opts) {
attrs = (attrs)? attrs : {};
opts = (opts)? opts : {};
-
+
/* turn type/attribute checking on by default! */
if (opts.typeChecking !== false) {
for (var a in attrs) {
@@ -251,25 +251,25 @@ VIE.prototype.Type = function (id, attrs, metadata) {
}
}
}
-
+
if (attrs['@type']) {
attrs['@type'].push(this.id);
} else {
attrs['@type'] = this.id;
}
-
+
return new this.vie.Entity(attrs, opts);
};
// ### toString()
-// This method returns the id of the type.
-// **Parameters**:
-// *nothing*
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{string}* : The id of the type.
-// **Example usage**:
+// This method returns the id of the type.
+// **Parameters**:
+// *nothing*
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{string}* : The id of the type.
+// **Example usage**:
//
// var x = new vie.Type(...);
// x.toString() === x.id;
@@ -280,31 +280,31 @@ VIE.prototype.Type = function (id, attrs, metadata) {
// ### VIE.Types()
// This is the constructor of a VIE.Types. This is a convenience class
-// to store ```VIE.Type``` instances properly.
-// **Parameters**:
-// *nothing*
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{VIE.Types}* : A **new** VIE.Types object.
-// **Example usage**:
+// to store ```VIE.Type``` instances properly.
+// **Parameters**:
+// *nothing*
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{VIE.Types}* : A **new** VIE.Types object.
+// **Example usage**:
//
// var types = new vie.Types();
VIE.prototype.Types = function () {
-
+
this._types = {};
-
+
// ### add(id, attrs, metadata)
-// This method adds a `VIE.Type` to the types.
-// **Parameters**:
-// *{string|VIE.Type}* **id** If this is a string, the type is created and directly added.
+// This method adds a `VIE.Type` to the types.
+// **Parameters**:
+// *{string|VIE.Type}* **id** If this is a string, the type is created and directly added.
// *{string|object}* **attrs** Only used if ```id``` is a string.
// *{object}* **metadata** potential additional metadata about the type.
-// **Throws**:
-// *{Error}* if a type with the given id already exists a ```VIE.Entity``` instance from this type.
-// **Returns**:
-// *{VIE.Types}* : The instance itself.
-// **Example usage**:
+// **Throws**:
+// *{Error}* if a type with the given id already exists a ```VIE.Entity``` instance from this type.
+// **Returns**:
+// *{VIE.Types}* : The instance itself.
+// **Example usage**:
//
// var types = new vie.Types();
// types.add("Person", ["name", "knows"]);
@@ -332,18 +332,18 @@ VIE.prototype.Types = function () {
}
return this;
};
-
+
// ### addOrOverwrite(id, attrs)
-// This method adds or overwrites a `VIE.Type` to the types. This is the same as
-// ``this.remove(id); this.add(id, attrs);``
-// **Parameters**:
-// *{string|VIE.Type}* **id** If this is a string, the type is created and directly added.
-// *{string|object}* **attrs** Only used if ```id``` is a string.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{VIE.Types}* : The instance itself.
-// **Example usage**:
+// This method adds or overwrites a `VIE.Type` to the types. This is the same as
+// ``this.remove(id); this.add(id, attrs);``
+// **Parameters**:
+// *{string|VIE.Type}* **id** If this is a string, the type is created and directly added.
+// *{string|object}* **attrs** Only used if ```id``` is a string.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{VIE.Types}* : The instance itself.
+// **Example usage**:
//
// var types = new vie.Types();
// types.addOrOverwrite("Person", ["name", "knows"]);
@@ -353,16 +353,16 @@ VIE.prototype.Types = function () {
}
return this.add(id, attrs);
};
-
+
// ### get(id)
-// This method retrieves a `VIE.Type` from the types by it's id.
-// **Parameters**:
-// *{string|VIE.Type}* **id** The id or the type itself.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{VIE.Type}* : The instance of the type or ```undefined```.
-// **Example usage**:
+// This method retrieves a `VIE.Type` from the types by it's id.
+// **Parameters**:
+// *{string|VIE.Type}* **id** The id or the type itself.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{VIE.Type}* : The instance of the type or ```undefined```.
+// **Example usage**:
//
// var types = new vie.Types();
// types.addOrOverwrite("Person", ["name", "knows"]);
@@ -379,19 +379,19 @@ VIE.prototype.Types = function () {
}
return undefined;
};
-
+
// ### remove(id)
// This method removes a type of given id from the type. This also
// removes all children if their only parent were this
// type. Furthermore, this removes the link from the
-// super- and subtypes.
-// **Parameters**:
-// *{string|VIE.Type}* **id** The id or the type itself.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{VIE.Type}* : The removed type.
-// **Example usage**:
+// super- and subtypes.
+// **Parameters**:
+// *{string|VIE.Type}* **id** The id or the type itself.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{VIE.Type}* : The removed type.
+// **Example usage**:
//
// var types = new vie.Types();
// types.addOrOverwrite("Person", ["name", "knows"]);
@@ -409,12 +409,12 @@ VIE.prototype.Types = function () {
return this;
}
delete this._types[t.id];
-
+
var subtypes = t.subtypes.list();
for (var c = 0; c < subtypes.length; c++) {
var childObj = subtypes[c];
if (childObj.supertypes.list().length === 1) {
- /* recursively remove all children
+ /* recursively remove all children
that inherit only from this type */
this.remove(childObj);
} else {
@@ -423,16 +423,16 @@ VIE.prototype.Types = function () {
}
return t;
};
-
+
// ### toArray() === list()
-// This method returns an array of all types.
-// **Parameters**:
-// *nothing*
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{array}* : An array of ```VIE.Type``` instances.
-// **Example usage**:
+// This method returns an array of all types.
+// **Parameters**:
+// *nothing*
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{array}* : An array of ```VIE.Type``` instances.
+// **Example usage**:
//
// var types = new vie.Types();
// types.addOrOverwrite("Person", ["name", "knows"]);
@@ -447,17 +447,17 @@ VIE.prototype.Types = function () {
// ### sort(types, desc)
// This method sorts an array of types in their order, given by the
-// inheritance. This returns a copy and leaves the original array untouched.
-// **Parameters**:
-// *{array|VIE.Type}* **types** The array of ```VIE.Type``` instances or ids of types to be sorted.
-// *{boolean}* **desc** If 'desc' is given and 'true', the array will be sorted
-// in descendant order.
-// *nothing*
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{array}* : A sorted copy of the array.
-// **Example usage**:
+// inheritance. This returns a copy and leaves the original array untouched.
+// **Parameters**:
+// *{array|VIE.Type}* **types** The array of ```VIE.Type``` instances or ids of types to be sorted.
+// *{boolean}* **desc** If 'desc' is given and 'true', the array will be sorted
+// in descendant order.
+// *nothing*
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{array}* : A sorted copy of the array.
+// **Example usage**:
//
// var types = new vie.Types();
// types.addOrOverwrite("Person", ["name", "knows"]);
@@ -466,10 +466,10 @@ VIE.prototype.Types = function () {
var self = this;
types = (jQuery.isArray(types))? types : [ types ];
desc = (desc)? true : false;
-
+
if (types.length === 0) return [];
var copy = [ types[0] ];
- var x, tlen;
+ var x, tlen;
for (x = 1, tlen = types.length; x < tlen; x++) {
var insert = types[x];
var insType = self.get(insert);
@@ -484,7 +484,7 @@ VIE.prototype.Types = function () {
}
}
}
-
+
//unduplicate
for (x = 0; x < copy.length; x++) {
if (copy.lastIndexOf(copy[x]) !== x) {
@@ -492,7 +492,7 @@ VIE.prototype.Types = function () {
x--;
}
}
-
+
if (!desc) {
copy.reverse();
}
View
254 src/Util.js
@@ -8,27 +8,27 @@
// ## VIE Utils
//
-// The here-listed methods are utility methods for the day-to-day
+// The here-listed methods are utility methods for the day-to-day
// VIE.js usage. All methods are within the static namespace ```VIE.Util```.
VIE.Util = {
// ### VIE.Util.toCurie(uri, safe, namespaces)
-// This method converts a given
+// This method converts a given
// URI into a CURIE (or SCURIE), based on the given ```VIE.Namespaces``` object.
// If the given uri is already a URI, it is left untouched and directly returned.
-// If no prefix could be found, an ```Error``` is thrown.
-// **Parameters**:
-// *{string}* **uri** The URI to be transformed.
-// *{boolean}* **safe** A flag whether to generate CURIEs or SCURIEs.
-// *{VIE.Namespaces}* **namespaces** The namespaces to be used for the prefixes.
-// **Throws**:
-// *{Error}* If no prefix could be found in the passed namespaces.
-// **Returns**:
-// *{string}* The CURIE or SCURIE.
-// **Example usage**:
+// If no prefix could be found, an ```Error``` is thrown.
+// **Parameters**:
+// *{string}* **uri** The URI to be transformed.
+// *{boolean}* **safe** A flag whether to generate CURIEs or SCURIEs.
+// *{VIE.Namespaces}* **namespaces** The namespaces to be used for the prefixes.
+// **Throws**:
+// *{Error}* If no prefix could be found in the passed namespaces.
+// **Returns**:
+// *{string}* The CURIE or SCURIE.
+// **Example usage**:
//
// var ns = new myVIE.Namespaces(
-// "http://viejs.org/ns/",
+// "http://viejs.org/ns/",
// { "dbp": "http://dbpedia.org/ontology/" }
// );
// var uri = "<http://dbpedia.org/ontology/Person>";
@@ -45,7 +45,7 @@ VIE.Util = {
if (k === '') {
delim = '';
}
- return ((safe)? "[" : "") +
+ return ((safe)? "[" : "") +
uri.replace(pattern, k + delim).replace(/>$/, '') +
((safe)? "]" : "");
}
@@ -54,19 +54,19 @@ VIE.Util = {
},
// ### VIE.Util.isCurie(curie, namespaces)
-// This method checks, whether
-// the given string is a CURIE and returns ```true``` if so and ```false```otherwise.
-// **Parameters**:
-// *{string}* **curie** The CURIE (or SCURIE) to be checked.
-// *{VIE.Namespaces}* **namespaces** The namespaces to be used for the prefixes.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{boolean}* ```true``` if the given curie is a CURIE or SCURIE and ```false``` otherwise.
-// **Example usage**:
+// This method checks, whether
+// the given string is a CURIE and returns ```true``` if so and ```false```otherwise.
+// **Parameters**:
+// *{string}* **curie** The CURIE (or SCURIE) to be checked.
+// *{VIE.Namespaces}* **namespaces** The namespaces to be used for the prefixes.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{boolean}* ```true``` if the given curie is a CURIE or SCURIE and ```false``` otherwise.
+// **Example usage**:
//
// var ns = new myVIE.Namespaces(
-// "http://viejs.org/ns/",
+// "http://viejs.org/ns/",
// { "dbp": "http://dbpedia.org/ontology/" }
// );
// var uri = "<http://dbpedia.org/ontology/Person>";
@@ -91,24 +91,24 @@ VIE.Util = {
},
// ### VIE.Util.toUri(curie, namespaces)
-// This method converts a
-// given CURIE (or save CURIE) into a URI, based on the given ```VIE.Namespaces``` object.
-// **Parameters**:
-// *{string}* **curie** The CURIE to be transformed.
-// *{VIE.Namespaces}* **namespaces** The namespaces object
-// **Throws**:
-// *{Error}* If no URI could be assembled.
-// **Returns**:
-// *{string}* : A string, representing the URI.
-// **Example usage**:
+// This method converts a
+// given CURIE (or save CURIE) into a URI, based on the given ```VIE.Namespaces``` object.
+// **Parameters**:
+// *{string}* **curie** The CURIE to be transformed.
+// *{VIE.Namespaces}* **namespaces** The namespaces object
+// **Throws**:
+// *{Error}* If no URI could be assembled.
+// **Returns**:
+// *{string}* : A string, representing the URI.
+// **Example usage**:
//
// var ns = new myVIE.Namespaces(
-// "http://viejs.org/ns/",
+// "http://viejs.org/ns/",
// { "dbp": "http://dbpedia.org/ontology/" }
// );
// var curie = "dbp:Person";
// var scurie = "[dbp:Person]";
-// VIE.Util.toUri(curie, ns);
+// VIE.Util.toUri(curie, ns);
// --> <http://dbpedia.org/ontology/Person>
// VIE.Util.toUri(scurie, ns);
// --> <http://dbpedia.org/ontology/Person>
@@ -129,16 +129,16 @@ VIE.Util = {
}
throw new Error("No prefix found for CURIE '" + curie + "'!");
},
-
+
// ### VIE.Util.isUri(something)
-// This method checks, whether the given string is a URI.
-// **Parameters**:
-// *{string}* **something** : The string to be checked.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{boolean}* : ```true``` if the string is a URI, ```false``` otherwise.
-// **Example usage**:
+// This method checks, whether the given string is a URI.
+// **Parameters**:
+// *{string}* **something** : The string to be checked.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{boolean}* : ```true``` if the string is a URI, ```false``` otherwise.
+// **Example usage**:
//
// var uri = "<http://dbpedia.org/ontology/Person>";
// var curie = "dbp:Person";
@@ -149,15 +149,15 @@ VIE.Util = {
},
// ### VIE.Util.mapAttributeNS(attr, ns)
-// This method maps an attribute of an entity into namespaces if they have CURIEs.
-// **Parameters**:
-// *{string}* **attr** : The attribute to be transformed.
-// *{VIE.Namespaces}* **ns** : The namespaces.
-// **Throws**:
-// *nothing*
-// **Returns**:
-// *{string}* : The transformed attribute's name.
-// **Example usage**:
+// This method maps an attribute of an entity into namespaces if they have CURIEs.
+// **Parameters**:
+// *{string}* **attr** : The attribute to be transformed.
+// *{VIE.Namespaces}* **ns** : The namespaces.
+// **Throws**:
+// *nothing*
+// **Returns**:
+// *{string}* : The transformed attribute's name.
+// **Example usage**:
//
// var attr = "name";
// var ns = myVIE.namespaces;
@@ -177,16 +177,16 @@ VIE.Util = {
}
return a;
},
-
+
// ### VIE.Util.rdf2Entities(service, results)
// This method converts *rdf/json* data from an external service
-// into VIE.Entities.
-// **Parameters**:
-// *{object}* **service** The service that retrieved the data.
-// *{object}* **results** The data to be transformed.
-// **Throws**:
-// *nothing*
-// **Returns**:
+// into VIE.Entities.
+// **Parameters**:
+// *{object}* **service** The service that retrieved the data.
+// *{object}* **results** The data to be transformed.
+// **Throws**:
+// *nothing*
+// **Returns**:
// *{[VIE.Entity]}* : An array, containing VIE.Entity instances which have been transformed from the given data.
rdf2Entities: function (service, results) {
if (typeof jQuery.rdf !== 'function') {
@@ -194,10 +194,10 @@ VIE.Util = {
return VIE.Util._rdf2EntitiesNoRdfQuery(service, results);
}
try {
- var rdf = (results instanceof jQuery.rdf)?
- results.base(service.vie.namespaces.base()) :
+ var rdf = (results instanceof jQuery.rdf)?
+ results.base(service.vie.namespaces.base()) :
jQuery.rdf().base(service.vie.namespaces.base()).load(results, {});
-
+
/* if the service contains rules to apply special transformation, they are executed here.*/
if (service.rules) {
var rules = jQuery.rdf.ruleset();
@@ -224,7 +224,7 @@ VIE.Util = {
}
var propertyUri = this.property.toString();
var propertyCurie;
-
+
try {
propertyCurie = service.vie.namespaces.curie(propertyUri);
//jQuery.createCurie(propertyUri, {namespaces: service.vie.namespaces.toObj(true)});
@@ -257,7 +257,7 @@ VIE.Util = {
}
entities[subject][propertyCurie].push(getValue(this.object));
});
-
+
_(entities).each(function(ent){
ent["@type"] = ent["@type"].concat(ent["rdf:type"]);
delete ent["rdf:type"];
@@ -267,7 +267,7 @@ VIE.Util = {
}
});
});
-
+
var vieEntities = [];
jQuery.each(entities, function() {
var entityInstance = new service.vie.Entity(this);
@@ -300,8 +300,8 @@ VIE.Util = {
if (typeof property === "string" && entity.get(property)) {
labelArr = _.flatten([entity.get(property)]);
_(labelArr).each(function(label) {
- /*
- The score is a natural number with 0 for the
+ /*
+ The score is a natural number with 0 for the
best candidate with the first preferred language
and first preferred property
*/
@@ -309,7 +309,7 @@ VIE.Util = {
score = p;
labelLang = label["@language"];
/*
- legacy code for compatibility with uotdated stanbol,
+ legacy code for compatibility with uotdated stanbol,
to be removed after may 2012
*/
if (typeof label === "string" && (label.indexOf("@") === label.length - 3 || label.indexOf("@") === label.length - 5)) {
@@ -337,10 +337,10 @@ VIE.Util = {
value: value
});
});
- /*
- property can be an object like
+ /*
+ property can be an object like
{
- property: "skos:broader",
+ property: "skos:broader",
makeLabel: function(propertyValueArr) { return "..."; }
}
*/
@@ -373,17 +373,17 @@ VIE.Util = {
}
},
-
+
// ### VIE.Util._rdf2EntitiesNoRdfQuery(service, results)
// This is a **private** method which should
// only be accessed through ```VIE.Util._rdf2Entities()``` and is a helper method in case there is no
-// rdfQuery loaded (*not recommended*).
-// **Parameters**:
-// *{object}* **service** The service that retrieved the data.
-// *{object}* **results** The data to be transformed.
-// **Throws**:
-// *nothing*
-// **Returns**:
+// rdfQuery loaded (*not recommended*).
+// **Parameters**:
+// *{object}* **service** The service that retrieved the data.
+// *{object}* **results** The data to be transformed.
+// **Throws**:
+// *nothing*
+// **Returns**:
// *{[VIE.Entity]}* : An array, containing VIE.Entity instances which have been transformed from the given data.
_rdf2EntitiesNoRdfQuery: function (service, results) {
var jsonLD = [];
@@ -418,25 +418,25 @@ VIE.Util = {
// the <a href="http://schema.org/">schema.org</a> ontology. It adds all the
// given types and properties as ```VIE.Type``` instances to the given VIE instance.
// If the paramenter **baseNS** is set, the method automatically sets the namespace
-// to the provided one. If it is not set, it will keep the base namespace of VIE untouched.
-// **Parameters**:
-// *{VIE}* **vie** The instance of ```VIE```.
-// *{object}* **SchemaOrg** The data imported from schema.org.
-// *{string|undefined}* **baseNS** If set, this will become the new baseNamespace within the given ```VIE``` instance.
-// **Throws**: