Wednesday 19 October 2016

Knowledge Engineering : Knowledge Management : Concept Maps

Concept maps are graphical tools for organizing and representing knowledge. They include concepts, usually enclosed in circles or boxes of some type, and relationships between concepts indicated by a connecting line linking two concepts.

A concept map or conceptual diagram is a diagram that depicts suggested relationships between concepts.
It is a graphical tool that instructional designers, engineers, technical writers, and others use to organize and structure knowledge.
A concept map typically represents ideas and information as boxes or circles, which it connects with labeled arrows in a downward-branching hierarchical structure. 
The relationship between concepts can be articulated in linking phrases such requires, or contributes to.
The technique for visualizing these relationships among different concepts is called concept mapping. 
Concept maps define the ontology of computer systems. We can easily say Concept maps can act as effective ways for Knowledge Representation.
There are some popular tools available for concept map drawing, you can refer to below link for more information about concept map drawing tools.
https://ltlatnd.wordpress.com/2011/05/11/ten-popular-concept-mapping-tools/
Following shows a sample concept map on FOOD, on how "Without the industrial chemical reduction of atmospheric nitrogen, starvation would be rampant in developing countries" :



Tuesday 18 October 2016

Mule ESB/Java : Reading a CSV/Delimiter file and process line by line

Enterprise Integration : Mule ESB 

Reading Pipe/CSV Files : Process individual lines and display in logger - the each line

Mule Flow Diagram :


Mule Config :

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:jdbc="http://www.mulesoft.org/schema/mule/jdbc" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">

<configuration doc:name="Configuration">
     <expression-language autoResolveVariables="true">
         <import class="org.mule.util.StringUtils" />
     </expression-language>
</configuration>

    <flow name="ImportCSVFile" >
     <!-- Component 1 : Folder to read CSV file source -->
<file:inbound-endpoint path="C:\InputFileFolderLocation\FileRead" pollingFrequency="5000" doc:name="Source" responseTimeout="10000"/>

<!-- Component 2: Convert between object arrays and strings -->
<object-to-string-transformer doc:name="Object to String"/>

<!-- Component 3: Split each row -->
<splitter expression="#[StringUtils.split(message.payload, '\n\r')]" doc:name="Splitter"/>
        <component class="RequestProcessor1" doc:name="Java"/>    
   
<!-- Component 4:  Paylod - display in logger -->
   <logger message=" #[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
               <!-- Component 5: Transform CSV(",")/Pipe("|") row in array and display in logger -->
              <expression-transformer expression="#[StringUtils.split(message.payload, '|')]" doc:name="Expression"/> 
 
</flow>
   </mule>

Mule Java Component Class and Code:

RequestProcessor1.java(for Java Component):

import java.util.StringTokenizer;

import org.mule.api.MuleEventContext;
import org.mule.api.lifecycle.Callable;

public class RequestProcessor1 implements Callable {

 @Override
public Object onCall(MuleEventContext eventContext) throws Exception {

String[] PayloadStr = eventContext.getMessage().getPayloadAsString().split("\\|", -1);
 Further Processing of PayloadStr ...

}
}...

So, as shown above, we can use the splitter /expression-tranform or splitter/custom java code to read file and process it line by line in Mule ESB.