plugin/src/java/org/pm4knime/node/conversion/log2table/FromXLogConverter.java
static DataTableSpec createAttrSpec(XLog log) {
		
		List<String> attrNames = new ArrayList();
		List<DataType> attrTypes = new ArrayList();
		// choose 5 random traces
		int size = (int) (0.2 * log.size())+1;
		Random random = new Random();
		List<Integer> traceIndices = new ArrayList();
		int i=0;
		while(i< size) {
			// 0 included but upper bound exclusive
			int idx = random.nextInt(log.size());
			if(!traceIndices.contains(idx)) {
				traceIndices.add(idx);
				i++;
			}
		}
		for(int idx : traceIndices) {
			XTrace trace = log.get(idx);
	//		System.out.println("Print the trace attributes");
			for (String attrKey : trace.getAttributes().keySet()) {
				if(attrNames.contains(XLogSpecUtil.TRACE_ATTRIBUTE_PREFIX + attrKey))
					continue;
				attrNames.add(XLogSpecUtil.TRACE_ATTRIBUTE_PREFIX + attrKey);
				attrTypes.add(findDataType(trace.getAttributes().get(attrKey)));
			}
			
			for(XEvent event :trace) {
				for (String attrKey : event.getAttributes().keySet()) {
					if(attrNames.contains(XLogSpecUtil.EVENT_ATTRIBUTE_PREFIX + attrKey))
						continue;
					attrNames.add(XLogSpecUtil.EVENT_ATTRIBUTE_PREFIX+ attrKey);
					attrTypes.add(findDataType(event.getAttributes().get(attrKey)));
				}
			}
		}
		
		XAttributeMap logAttrMap = log.getAttributes();
		// no need to get the log name
		String tName = XLog2TableConverterNodeModel.CFG_TABLE_NAME;
		
		String[] colNames = new String[attrNames.size()];
		attrNames.toArray(colNames);
		DataType[] colTypes = new DataType[attrTypes.size()];
		attrTypes.toArray(colTypes);
		
		DataTableSpec outSpec = new DataTableSpec(tName, colNames, colTypes);
		
		return outSpec;
	}
/*
	 * if we only check the first trace and event log, it is possible that we don't have enough 
		information to get full spec!! My solution is?? We can read all log and then give the 
		specification. One possible solution, read more trace and event, 
		we sample 5 traces and read all its events.
		
		Nana, I tried again to extract the Spec for the table, but now it seems repeative work
	 */
if we only check the first trace and event log, it is possible that we don't have enough
information to get full spec!.

Nana, I tried again to extract the Spec for the table, but now it seems repeative work
if we only check the first trace and event log it is possible that we don ' t have enough information to get full spec! . Nana I tried again to extract the Spec for the table but now it seems repeative work
static DataTableSpec createAttrSpec(XLog log) {
		List<String> attrNames = new ArrayList();
		List<DataType> attrTypes = new ArrayList();
		int size = (int) (0.2 * log.size())+1;
		Random random = new Random();
		List<Integer> traceIndices = new ArrayList();
		int i=0;
		while(i< size) {
			int idx = random.nextInt(log.size());
			if(!traceIndices.contains(idx)) {
				traceIndices.add(idx);
				i++;
			}
		}
		for(int idx : traceIndices) {
			XTrace trace = log.get(idx);
			for (String attrKey : trace.getAttributes().keySet()) {
				if(attrNames.contains(XLogSpecUtil.TRACE_ATTRIBUTE_PREFIX + attrKey))
					continue;
				attrNames.add(XLogSpecUtil.TRACE_ATTRIBUTE_PREFIX + attrKey);
				attrTypes.add(findDataType(trace.getAttributes().get(attrKey)));
			}
			for(XEvent event :trace) {
				for (String attrKey : event.getAttributes().keySet()) {
					if(attrNames.contains(XLogSpecUtil.EVENT_ATTRIBUTE_PREFIX + attrKey))
						continue;
					attrNames.add(XLogSpecUtil.EVENT_ATTRIBUTE_PREFIX+ attrKey);
					attrTypes.add(findDataType(event.getAttributes().get(attrKey)));
				}
			}
		}
		XAttributeMap logAttrMap = log.getAttributes();
		String tName = XLog2TableConverterNodeModel.CFG_TABLE_NAME;
		String[] colNames = new String[attrNames.size()];
		attrNames.toArray(colNames);
		DataType[] colTypes = new DataType[attrTypes.size()];
		attrTypes.toArray(colTypes);
		DataTableSpec outSpec = new DataTableSpec(tName, colNames, colTypes);
		return outSpec;
	}
static DataTableSpec createAttrSpec ( XLog log ) { List < String > attrNames = new ArrayList ( ) ; List < DataType > attrTypes = new ArrayList ( ) ; int size = ( int ) ( 0.2 * log . size ( ) ) + 1 ; Random random = new Random ( ) ; List < Integer > traceIndices = new ArrayList ( ) ; int i = 0 ; while ( i < size ) { int idx = random . nextInt ( log . size ( ) ) ; if ( ! traceIndices . contains ( idx ) ) { traceIndices . add ( idx ) ; i ++ ; } } for ( int idx : traceIndices ) { XTrace trace = log . get ( idx ) ; for ( String attrKey : trace . getAttributes ( ) . keySet ( ) ) { if ( attrNames . contains ( XLogSpecUtil . TRACE_ATTRIBUTE_PREFIX + attrKey ) ) continue ; attrNames . add ( XLogSpecUtil . TRACE_ATTRIBUTE_PREFIX + attrKey ) ; attrTypes . add ( findDataType ( trace . getAttributes ( ) . get ( attrKey ) ) ) ; } for ( XEvent event : trace ) { for ( String attrKey : event . getAttributes ( ) . keySet ( ) ) { if ( attrNames . contains ( XLogSpecUtil . EVENT_ATTRIBUTE_PREFIX + attrKey ) ) continue ; attrNames . add ( XLogSpecUtil . EVENT_ATTRIBUTE_PREFIX + attrKey ) ; attrTypes . add ( findDataType ( event . getAttributes ( ) . get ( attrKey ) ) ) ; } } } XAttributeMap logAttrMap = log . getAttributes ( ) ; String tName = XLog2TableConverterNodeModel . CFG_TABLE_NAME ; String [ ] colNames = new String [ attrNames . size ( ) ] ; attrNames . toArray ( colNames ) ; DataType [ ] colTypes = new DataType [ attrTypes . size ( ) ] ; attrTypes . toArray ( colTypes ) ; DataTableSpec outSpec = new DataTableSpec ( tName , colNames , colTypes ) ; return outSpec ; }
if we only check the first trace and event log, it is possible that we don't have enough
information to get full spec!!
if we only check the first trace and event log it is possible that we don ' t have enough information to get full spec!!
// choose 5 random traces // 0 included but upper bound exclusive //		System.out.println("Print the trace attributes"); // no need to get the log name