updating ctx model analyser

Perumal Perumal 2014-10-06

added src/main/java/net/timbusproject/dpes/analyse/ContextModelAnalyser.java
changed src/main/java/net/timbusproject/dpes/owlmgr/OwlManager.java
copied src/main/java/net/timbusproject/dpes/owlmgr/Main.java -> src/main/java/net/timbusproject/dpes/owlmgr/Testing.java
src/main/java/net/timbusproject/dpes/analyse/ContextModelAnalyser.java Diff Switch to side-by-side view
Loading...
src/main/java/net/timbusproject/dpes/owlmgr/OwlManager.java Diff Switch to side-by-side view
Loading...
src/main/java/net/timbusproject/dpes/owlmgr/Main.java to src/main/java/net/timbusproject/dpes/owlmgr/Testing.java
--- a/src/main/java/net/timbusproject/dpes/owlmgr/Main.java
+++ b/src/main/java/net/timbusproject/dpes/owlmgr/Testing.java
@@ -10,9 +10,12 @@
 
 import org.semanticweb.owlapi.model.OWLOntologyCreationException;
 
+import com.amazonaws.util.json.JSONException;
+
 public class Main {
 	
-	public static void main(String[] args) throws OWLOntologyCreationException {
+	@SuppressWarnings("unchecked")
+	public static void main(String[] args) throws OWLOntologyCreationException, JSONException {
 		
 		Properties systemSettings = System.getProperties();
         systemSettings.put("http.proxyHost", "proxy-ir.intel.com");
@@ -29,17 +32,23 @@
         //String ontURI ="https://timbus.teco.edu/public/ontologies/examples/WP7-OSWF-Characterization/wp7-oswf-characterisation-debian-software.rdf";
         //String ontURI="https://timbus.teco.edu/public/ontologies/examples/WP8-CAD_CAM/wp8-cadcam-windows-dll.owl";
         //String ontURI="https://timbus.teco.edu/public/ontologies/examples/WP8-CAD_CAM/wp8-cadcam-windows-dll.owl"; 
-	    String ontURI="https://timbus.teco.edu/public/ontologies/examples/WP8-MathSim/wp8-mathsim-debian-software.rdf";
-	    //String ontURI="https://timbus.teco.edu/svn/public/ontologies/examples/WP7-Phaidra/inferred.owl";
+	    //String ontURI="https://timbus.teco.edu/public/ontologies/examples/WP8-MathSim/wp8-mathsim-debian-software.rdf";
+	    //String ontURI="https://timbus.teco.edu/ontologies/examples/WP7-Phaidra/inferred.owl";
+	    //String ontURI="http://timbus.teco.edu/ontologies/examples/WP7-Phaidra/main.owl";
+	    //String ontURI="http://timbus.teco.edu/ontologies/examples/WP7-Phaidra/extracted/merged.owl";
+	    String ontURI="http://timbus.teco.edu/ontologies/examples/WP7-Phaidra/wp7-phaidra-debian-sw.owl";
+	    //String ontURI="/home/theguru/timbus/wp7-phaidra-debian-sw_withOS.owl";
 	    OwlManager olMgr = new OwlManager(ontURI, DPESConstants.OWL_ONTOLOGY_SOURCE_URL);
-  // =========================================================== //
+	    
+// =========================================================== //
  
-//    String owlClass ="Package";
-//        HashMap<String, String> clsElmt = olMgr.getElementsFromClass(owlClass, olMgr.mainOntology);
-//        olMgr.printHashMap(clsElmt);
+//    String owlClass ="Machine";
+//        HashMap<String, String> clsElmt = olMgr.getElementsFromClass(owlClass);
+//        System.out.println(" ====== Machine ====== ");
+//        new Main().printHashMap(clsElmt);
     
 // 	String dataProps = olMgr.getDataPropertyFromIndividual(
-//        		"007f333f-cafe-3604-8368-e3923ef67323", 
+//        		"xserver-common_2%3A1.12.4-6", 
 //        		"http://timbus.teco.edu/ontologies/DSOs/CUDF.owl", "hasSourceLocation");
 // 	System.out.println("dataProps : "+dataProps);
      
@@ -59,20 +68,42 @@
 //  ArrayList<OWLIndividual> objProp = olMgr.getMultipleObjectPropertyFromIndividual("0047f68b-7194-354a-958a-68cda6dbb2e8",
 //     		   "http://timbus.teco.edu/ontologies/DSOs/CUDF.owl","hasDependency");
 //  System.out.println("getMultipleObjectPropertyFromIndividual : "+objProp.toString());
-  
-  ArrayList<String> objProp = olMgr.getAllIndividualNames();
-    for( String name : objProp){
-	//   System.out.println("getAllIndividualNames : "+name);
-	 	
-	String dataProps = olMgr.getDataPropertyFromIndividual(name, 
-		"http://timbus.teco.edu/ontologies/DSOs/CUDF.owl", "hasSourceLocation");
-	System.out.println("dataProps->hasSourceLocation : "+dataProps);   
+  int count=0;
+  ArrayList<String> objProp1 = olMgr.getAllIndividualNames();
+    for( String name : objProp1){
+	  // if(name.equalsIgnoreCase("machine"))
+    	count++;
+    	//System.out.println(count + " :  getAllIndividualNames : "+name);
+//	 	
+//  String dataProps = olMgr.getDataPropertyFromIndividual(name, 
+//	"http://timbus.teco.edu/ontologies/DSOs/CUDF.owl", "hasSourceLocation");
+//		System.out.println("dataProps->hasSourceLocation : "+dataProps);
+
+//		String dataProps = olMgr.getDataPropertyFromIndividual(name, 
+//				"http://timbus.teco.edu/ontologies/DSOs/software.owl", "hasDistributionID");		
+//		if(dataProps != null)
+//		System.out.println("dataProps->hasSourceLocation : "+dataProps+" name :"+name);
+		
+//		
+//  String dataProps1 = olMgr.getDataPropertyFromIndividual(name, 
+//	"http://timbus.teco.edu/ontologies/DSOs/CUDF.owl", "hasName");
+//		System.out.println("dataProps->hasName : "+dataProps1);
 	   
-//		String dataProps = olMgr.getDataPropertyFromIndividual(name, 
-//		"http://timbus.teco.edu/ontologies/DSOs/DLLDSO.owl", "hasLocation");
-//	System.out.println("dataProps->hasSourceLocation : "+dataProps);   	   
-	   
-   }      
+//  String dataProps = olMgr.getDataPropertyFromIndividual(name, 
+//	"http://timbus.teco.edu/ontologies/DSOs/DLLDSO.owl", "hasLocation");
+//		System.out.println("dataProps->hasSourceLocation : "+dataProps);   
+    	
+//   ArrayList<String> objProp = olMgr.getMultipleObjectPropertyFromIndividualAsStrings(name,
+//		   "http://timbus.teco.edu/ontologies/DSOs/CUDF.owl","hasDependency");  
+//		for( String str : objProp){
+//			   System.out.println(count + " : "+name+" : ObjectPropertyFromIndividual : "+str);
+//		}
+    	
+//    	String dataProps = olMgr.getDataPropertyFromIndividual(name, 
+//    	"http://timbus.teco.edu/ontologies/DIO.owl", "composes");
+//    		System.out.println(count +" : dataProps->composes : "+dataProps);   
+}
+	
 //		OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
 //		OWLOntology ontology = manager.createOntology(IRI
 //				.create("http://timbusproject.net/test"));
@@ -82,7 +113,7 @@
 	}
 
 	private void printHashMap(HashMap<String, String> maps){
-		System.out.println("Using EntrySet");
+		//System.out.println("Using EntrySet");
         for(Map.Entry<String, String> map : maps.entrySet()){
             System.out.println(map.getKey() +" :: "+ map.getValue());        
         }