package hozo.maptool; import java.awt.Color; import java.awt.Font; import java.io.File; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.Vector; import javax.swing.JOptionPane; import hozo.sparql.gui.SparqlBuilderPanel; import org.biohackathon.SPARQLBuilder.OWL.ClassLink; import org.biohackathon.SPARQLBuilder.OWL.Direction; import org.biohackathon.SPARQLBuilder.OWL.Path; /***縲�008/10/18縲�kozaki 縲�AP逕滓�縺ョ縺溘a縺ォ�梧ウ暮�繧ОWL縺ョAPI縺九i�後�繝��逕ィ縺ョ繝��繧ソ繧剃ス懈�縺吶k縺溘a縺ョ 縲�Γ繧ス繝�ラ鬘槭r縺薙�繧ッ繝ゥ繧ケ縺ォ縺セ縺ィ繧√k�� ***/ public class MapFactory implements Runnable{ ExtendBP exbp; public ExtendFrame exbpframe; Vector focal_points;//譛��縺ォ驕ク謚槭@縺櫻ode(縺ェ縺ゥ)繧剃ソ晄戟縺吶k boolean isSubLung; static boolean isGrayView=false; Vector checked_nodes; boolean search_shortest=true;//繧オ繝シ繝√ヱ繧ケ縺ァ譛�洒繝代せ繧呈、懃エ「縺吶k int serch_depth = 10;//繧オ繝シ繝√ヱ繧ケ縺ァ譛�洒繝代せ繧呈、懃エ「縺吶k豺ア縺包シ域怙遏ュ繝代せ讀懃エ「繧偵@縺ェ縺�→縺阪�蠢�★菴ソ縺�シ� Vector temp_nodes; SparqlBuilderPanel spBuilder; public static void main (String[] args) { MapFactory map = new MapFactory(); //map.loadPathList(map.getDummyPathList()); } public List getDummyPathList(){ ArrayList pathlist = new ArrayList(); // ArrayList class_link_list = new ArrayList() {{ // add(new ClassLink("propertyURI", "linkedClassURI2", Direction.forward)); // add(new ClassLink("propertyURI2", "linkedClassURI3", Direction.forward)); // add(new ClassLink("propertyURI3", "linkedClassURI4", Direction.forward)); // }}; // Path path = new Path("StartClass1", class_link_list); // pathlist.add(path); // return pathlist; } public void setSPARQLbuilder(SparqlBuilderPanel builder){ this.spBuilder = builder; } // void setSPARQLquery(Path path){ // this.spBuilder; // } public MapFactory() { exbpframe = new ExtendFrame(this); exbp = exbpframe.getExtendBP(); focal_points = new Vector(); temp_nodes = new Vector(); // focal_points.add("TEST"); // focal_points.add("TEST2"); // isSubLung=hze.isSubLang; // isGrayView=hze.isGrayView;//#kozaki 2009/07/28 // exbp.setHZEditor(hze); // exbpframe.select_dialog = new EtendBPSelectDialog(exbp,exbpframe); exbpframe.setVisible(true); exbpframe.RefreshExbp(); // if(focal_points.size()==1){ // exbp.cmd_dialog.setCommandOptions(exbp.exbp_node_center); // } // // treeSelectDialog = new TreeSelectDialog(true); // treeSelectDialog.setHZEditor(this.hzEditor); // treeSelectDialog.setSubLang(this.isSubLung); // treeSelectDialog.setSize(450, 600); // } public void loadPathList(Path[] pathlist){ if(pathlist.length==0){ JOptionPane.showMessageDialog(null, "NO PATH!!"); return; } Path path = pathlist[0]; this.exbp.exbp_node_center = new ExbpNode(getTempLabel(path.getStartClass())); for(int i = 0; i"+path.getClassLinks().size()); String target_class = path.getStartClass(); // ExbpNode node = this.exbp.findExbpNode(target_class); ExbpNode node = this.exbp.exbp_node_center; List links = path.getClassLinks(); for(ClassLink link : links){ String next_class = link.getLinkedClassURI(); System.out.println("="+link.getNumOfLinks()+"=>"+next_class); /* String next_class_lbl =""; int index = next_class.lastIndexOf("/"); if(index>0 && index0 && index20 && index0 && index2"+lbl); if(this.isSubLung){ org_node = this.hzEditor.WCEditor.findNodeWithSubLang(lbl); } else{ org_node = this.hzEditor.findRH(lbl); } } else{ if(this.isSubLung){ org_node = this.hzEditor.WCEditor.findNodeWithSubLang(lbl); } else{ org_node = this.hzEditor.findNode(lbl); } } node.setOrgNode(org_node); if(org_node!=null){ //System.out.println("setOrgNodes:::"+lbl+"<=>"+org_node.getLabel()); }else{ //System.out.println("setOrgNodes:::"+lbl+"<=>NOT FOUND!"); } } */ } //蜈�→縺ェ繧軌bject縺九iFocalPoint縺ィ縺ェ繧畿xbpNode繧剃ス懊k縲食ozo莉・螟悶〒縺ッ繧ェ繝シ繝舌�繝ゥ繧、繝峨☆繧九� ExbpNode[] setFocalPoints(){ // if (this.hzEditor==null) return null; ExbpNode[] exbpnodes = null; exbp.nodes.removeAllElements(); // Vector chi_nodes; // GraphicObject gobj=null; // Object ob=null; if (focal_points.size() == 1) {//�代▽縺ョNode繧帝∈謚槭@縺滄圀縺ョ蜃ヲ逅� Object gobj = focal_points.firstElement(); //gobj =(GraphicObject) focal_points.firstElement(); if(gobj instanceof String){ exbp.exbp_node_center =new ExbpNode((String)gobj); exbp.exbp_node_center.setOrgNode(gobj); exbp.nodes.add(exbp.exbp_node_center); exbpnodes = new ExbpNode[1]; exbpnodes[0]=exbp.exbp_node_center; } else if(gobj instanceof Object){ System.out.println("*** ERROR:Node繧帝∈謚槭☆繧句ソ�ヲ√′縺ゅj縺セ縺�:" ); } else{//驕ク謚槭↑縺励�蝣エ蜷医��後お繝ゥ繝シ繧貞�縺励※邨ゆコ� JOptionPane.showMessageDialog(exbpframe, "You Have to select [Node]!", "ERROR", JOptionPane.ERROR_MESSAGE); System.out.println("ERROR:Node繧帝∈謚槭☆繧句ソ�ヲ√′縺ゅj縺セ縺�:" ); exbpframe.dispose(); } } else {//隍�焚Node繧帝∈謚槭@縺滄圀縺ョ蜃ヲ逅� if(focal_points.size() > 1){ exbp.exbp_node_center = new ExbpNode("(ROOT)"); exbp.nodes.addElement(exbp.exbp_node_center); Vector chi_nodes = new Vector(); Enumeration node_en = focal_points.elements(); while(node_en.hasMoreElements()){ Object gobj2 = node_en.nextElement(); if(gobj2 instanceof String){ ExbpNode chinode = new ExbpNode((String)gobj2); chinode.setOrgNode(gobj2); exbp.exbp_node_center.addChild(chinode); exbp.nodes.add(chinode); } exbpnodes = new ExbpNode[exbp.exbp_node_center.children.size()]; for(int i=0;i exbpnodes){} /* public String[] getSelectedClass(String[] labels){ TreeSelectDialog treeSelectDialog = new TreeSelectDialog(true); treeSelectDialog.setHZEditor(this.hzEditor); treeSelectDialog.setSubLang(this.isSubLung); treeSelectDialog.updateTree(); //treeSelectDialog.setSize(320, 450); if(labels.length>0){ String label = labels[0]; for(int i=1;i