function combineClasses( baseObjects, attributes ){
	    var combinations = [];
	    var prototypeMap = createLowerCasePrototypeMap(nodePrototypeMap);

	    if ( baseObjects ) {
	      baseObjects.forEach(function ( element ){
	        var matchingAttribute;

	        if ( attributes ) {
	          // Look for an attribute with the same id and merge them
	          for ( var i = 0; i < attributes.length; i++ ) {
	            var attribute = attributes[i];
	            if ( element.id === attribute.id ) {
	              matchingAttribute = attribute;
	              break;
	            }
	          }
	          addAdditionalAttributes(element, matchingAttribute);
	        }

	        // Then look for a prototype to add its properties
	        var Prototype = prototypeMap.get(element.type.toLowerCase());

	        if ( Prototype ) {
	          addAdditionalAttributes(element, Prototype); // TODO might be unnecessary

	          var node = new Prototype(graph);
	          node.annotations(element.annotations)
	            .baseIri(element.baseIri)
	            .comment(element.comment)
	            .complement(element.complement)
	            .disjointUnion(element.disjointUnion)
	            .description(element.description)
	            .equivalents(element.equivalent)
	            .id(element.id)
	            .intersection(element.intersection)
	            .label(element.label)
                  .staxBackgroundColour(element.staxBackgroundColour)
                  .staxProperties(element.staxProperties)
                  .contentType(element.contentType)
                  .editUrl(element.editUrl)
                  .resetFocusUrl(element.resetFocusUrl)
	            // .type(element.type) Ignore, because we predefined it
	            .union(element.union)
	            .iri(element.iri);
	          if ( element.pos ) {
	            node.x = element.pos[0];
	            node.y = element.pos[1];
	            node.px = node.x;
	            node.py = node.y;
	          }
	          //class element pin
	          var elementPinned = element.pinned;
	          if ( elementPinned === true ) {
	            node.pinned(true);
	            graph.options().pickAndPinModule().addPinnedElement(node);
	          }
	          // Create node objects for all individuals
	          if ( element.individuals ) {
	            element.individuals.forEach(function ( individual ){
	              var individualNode = new Prototype(graph);
	              individualNode.label(individual.labels)
	                .iri(individual.iri);

	              node.individuals().push(individualNode);
	            });
	          }

	          if ( element.attributes ) {
	            var deduplicatedAttributes = d3.set(element.attributes.concat(node.attributes()));
	            node.attributes(deduplicatedAttributes.values());
	          }
	          combinations.push(node);
	        } else {
	          console.error("Unknown element type: " + element.type);
	        }
	      });
	    }

	    return combinations;
	  }
/**
	   * Combines the passed objects with its attributes and prototypes. This also applies
	   * attributes defined in the base of the prototype.
	   */
Combines the passed objects with its attributes and prototypes. This also applies
attributes defined in the base of the prototype.
Combines the passed objects with its attributes and prototypes . This also applies attributes defined in the base of the prototype .
function combineClasses( baseObjects, attributes ){
	    var combinations = [];
	    var prototypeMap = createLowerCasePrototypeMap(nodePrototypeMap);
	    if ( baseObjects ) {
	      baseObjects.forEach(function ( element ){
	        var matchingAttribute;
	        if ( attributes ) {
	          for ( var i = 0; i < attributes.length; i++ ) {
	            var attribute = attributes[i];
	            if ( element.id === attribute.id ) {
	              matchingAttribute = attribute;
	              break;
	            }
	          }
	          addAdditionalAttributes(element, matchingAttribute);
	        }
	        var Prototype = prototypeMap.get(element.type.toLowerCase());
	        if ( Prototype ) {
	          addAdditionalAttributes(element, Prototype); 
	          var node = new Prototype(graph);
	          node.annotations(element.annotations)
	            .baseIri(element.baseIri)
	            .comment(element.comment)
	            .complement(element.complement)
	            .disjointUnion(element.disjointUnion)
	            .description(element.description)
	            .equivalents(element.equivalent)
	            .id(element.id)
	            .intersection(element.intersection)
	            .label(element.label)
                  .staxBackgroundColour(element.staxBackgroundColour)
                  .staxProperties(element.staxProperties)
                  .contentType(element.contentType)
                  .editUrl(element.editUrl)
                  .resetFocusUrl(element.resetFocusUrl)
	            .union(element.union)
	            .iri(element.iri);
	          if ( element.pos ) {
	            node.x = element.pos[0];
	            node.y = element.pos[1];
	            node.px = node.x;
	            node.py = node.y;
	          }
	          var elementPinned = element.pinned;
	          if ( elementPinned === true ) {
	            node.pinned(true);
	            graph.options().pickAndPinModule().addPinnedElement(node);
	          }
	          if ( element.individuals ) {
	            element.individuals.forEach(function ( individual ){
	              var individualNode = new Prototype(graph);
	              individualNode.label(individual.labels)
	                .iri(individual.iri);
	              node.individuals().push(individualNode);
	            });
	          }
	          if ( element.attributes ) {
	            var deduplicatedAttributes = d3.set(element.attributes.concat(node.attributes()));
	            node.attributes(deduplicatedAttributes.values());
	          }
	          combinations.push(node);
	        } else {
	          console.error("Unknown element type: " + element.type);
	        }
	      });
	    }
	    return combinations;
	  }
function combineClasses ( baseObjects , attributes ) { var combinations = [ ] ; var prototypeMap = createLowerCasePrototypeMap ( nodePrototypeMap ) ; if ( baseObjects ) { baseObjects . forEach ( function ( element ) { var matchingAttribute ; if ( attributes ) { for ( var i = 0 ; i < attributes . length ; i ++ ) { var attribute = attributes [ i ] ; if ( element . id === attribute . id ) { matchingAttribute = attribute ; break ; } } addAdditionalAttributes ( element , matchingAttribute ) ; } var Prototype = prototypeMap . get ( element . type . toLowerCase ( ) ) ; if ( Prototype ) { addAdditionalAttributes ( element , Prototype ) ; var node = new Prototype ( graph ) ; node . annotations ( element . annotations ) . baseIri ( element . baseIri ) . comment ( element . comment ) . complement ( element . complement ) . disjointUnion ( element . disjointUnion ) . description ( element . description ) . equivalents ( element . equivalent ) . id ( element . id ) . intersection ( element . intersection ) . label ( element . label ) . staxBackgroundColour ( element . staxBackgroundColour ) . staxProperties ( element . staxProperties ) . contentType ( element . contentType ) . editUrl ( element . editUrl ) . resetFocusUrl ( element . resetFocusUrl ) . union ( element . union ) . iri ( element . iri ) ; if ( element . pos ) { node . x = element . pos [ 0 ] ; node . y = element . pos [ 1 ] ; node . px = node . x ; node . py = node . y ; } var elementPinned = element . pinned ; if ( elementPinned === true ) { node . pinned ( true ) ; graph . options ( ) . pickAndPinModule ( ) . addPinnedElement ( node ) ; } if ( element . individuals ) { element . individuals . forEach ( function ( individual ) { var individualNode = new Prototype ( graph ) ; individualNode . label ( individual . labels ) . iri ( individual . iri ) ; node . individuals ( ) . push ( individualNode ) ; } ) ; } if ( element . attributes ) { var deduplicatedAttributes = d3 . set ( element . attributes . concat ( node . attributes ( ) ) ) ; node . attributes ( deduplicatedAttributes . values ( ) ) ; } combinations . push ( node ) ; } else { console . error ( "Unknown element type: " + element . type ) ; } } ) ; } return combinations ; }
Combines the passed objects with its attributes and prototypes.
Combines the passed objects with its attributes and prototypes .
// Look for an attribute with the same id and merge them // Then look for a prototype to add its properties // TODO might be unnecessary // .type(element.type) Ignore, because we predefined it //class element pin // Create node objects for all individuals