@@ -140,7 +140,6 @@ WOQLQuery.prototype.property = function(proId, type_or_value) {
140
140
return this
141
141
}
142
142
143
-
144
143
WOQLQuery . prototype . node = function ( node , type ) {
145
144
type = type || false
146
145
if ( type == 'add_quad' ) type = 'AddQuad'
@@ -170,22 +169,41 @@ WOQLQuery.prototype.insert_data = function(data, refGraph) {
170
169
type = this . cleanType ( data . type , true )
171
170
this . insert ( data . id , type , refGraph )
172
171
if ( data . label ) {
173
- this . label ( data . label )
172
+ console . log ( data . label )
173
+ if ( Array . isArray ( data . label ) ) {
174
+ data . label . forEach ( value => {
175
+ this . label ( value )
176
+ } )
177
+ } else {
178
+ this . label ( data . label )
179
+ }
174
180
}
175
181
if ( data . description ) {
176
- this . description ( data . description )
182
+ if ( Array . isArray ( data . description ) ) {
183
+ data . description . forEach ( value => {
184
+ this . description ( value )
185
+ } )
186
+ } else {
187
+ this . description ( data . description )
188
+ }
177
189
}
178
190
for ( var k in data ) {
179
191
if ( [ 'id' , 'label' , 'type' , 'description' ] . indexOf ( k ) == - 1 ) {
180
- this . property ( k , data [ k ] )
192
+ if ( Array . isArray ( data [ k ] ) ) {
193
+ data [ k ] . forEach ( value => {
194
+ this . property ( k , value )
195
+ } )
196
+ } else {
197
+ this . property ( k , data [ k ] )
198
+ }
181
199
}
182
200
}
183
201
}
184
202
return this
185
203
}
186
204
187
205
/**
188
- * @description Creates a pattern matching rule for a quad [Subject, Predicate, Object, Graph] or for a triple [Subject, Predicate, Object]
206
+ * @description Creates a pattern matching rule for a quad [Subject, Predicate, Object, Graph] or for a triple [Subject, Predicate, Object]
189
207
* add extra information about the type of the value object
190
208
* @param {string } subject - The IRI of a triple’s subject or a variable
191
209
* @param {string } predicate - The IRI of a property or a variable
@@ -379,10 +397,10 @@ WOQLQuery.prototype._string_matches_object = function(str, node) {
379
397
}
380
398
381
399
/**
382
- *
383
- * @param {string } n
400
+ *
401
+ * @param {string } n
384
402
* @param {string } which
385
- * @returns {WOQLQuery }
403
+ * @returns {WOQLQuery }
386
404
*/
387
405
388
406
WOQLQuery . prototype . _card = function ( n , which ) {
0 commit comments