--- a/src/main/java/net/timbusproject/dpes/owlmgr/Main.java
+++ b/src/main/java/net/timbusproject/dpes/analyse/ContextModelAnalyser.java
@@ -1,19 +1,46 @@
-package net.timbusproject.dpes.owlmgr;
+package net.timbusproject.dpes.analyse;
+import java.sql.SQLException;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Properties;
import net.timbusproject.dpes.common.DPESConstants;
import net.timbusproject.dpes.common.SSLTool;
+import net.timbusproject.dpes.owlmgr.OwlManager;
+import org.json.JSONException;
+import org.json.JSONObject;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
-public class Main {
+public class ContextModelAnalyser {
+
+ private String ctxPathLocal="http://timbus.teco.edu/ontologies/examples/WP7-Phaidra/wp7-phaidra-debian-sw.owl";
- public static void main(String[] args) throws OWLOntologyCreationException {
-
+ public ContextModelAnalyser(String bpId) throws SQLException, JSONException{
+ DPSolutionAnalyser dpSolAnalyser = new DPSolutionAnalyser();
+ //JSONObject docLoc = dpSolAnalyser.getPreservationDocumentLocations(bpId);
+ //this.ctxPathLocal=docLoc.getString("ontologyLocalPath");
+ }
+
+ @SuppressWarnings("unchecked")
+ public String getBasicCtxModelStructure() throws com.amazonaws.util.json.JSONException{
+ OwlManager olMgr = new OwlManager(this.ctxPathLocal, DPESConstants.OWL_ONTOLOGY_SOURCE_URL);
+ org.json.simple.JSONObject jObj=new org.json.simple.JSONObject();
+ jObj.put("dataProps", olMgr.getDataPropertiesAxiomsJson());
+ jObj.put("objectProps", olMgr.getObjectPropertiesAxiomsJson());
+ jObj.put("classProps", olMgr.getOwlClassesJson());
+ jObj.put("namedIndividual", olMgr.getAllIndividualNames());
+ System.out.println(jObj.toJSONString());
+ return jObj.toJSONString();
+ }
+
+ public ArrayList<String> getAllIndividualNames(){
+ OwlManager olMgr = new OwlManager(this.ctxPathLocal, DPESConstants.OWL_ONTOLOGY_SOURCE_URL);
+ ArrayList<String> indviNames = olMgr.getAllIndividualNames();
+ return indviNames;
+ }
+
+ public static void main(String[] args) throws OWLOntologyCreationException, JSONException, com.amazonaws.util.json.JSONException, SQLException {
Properties systemSettings = System.getProperties();
systemSettings.put("http.proxyHost", "proxy-ir.intel.com");
systemSettings.put("http.proxyPort", "911");
@@ -22,70 +49,9 @@
System.setProperties(systemSettings);
SSLTool.disableCertificateValidation();
-
- //String ontURI="/home/theguru/downloads/wp7-oswf-characterisation-linux-hardware.owl";
- //String ontURI="http://protege.cim3.net/file/pub/ontologies/travel/travel.owl";
- //String ontURI="https://timbus.teco.edu/public/ontologies/examples/WP7-OSWF-Characterization/wp7-oswf-characterisation-linux-hardware.owl";
- //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";
- 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 dataProps = olMgr.getDataPropertyFromIndividual(
-// "007f333f-cafe-3604-8368-e3923ef67323",
-// "http://timbus.teco.edu/ontologies/DSOs/CUDF.owl", "hasSourceLocation");
-// System.out.println("dataProps : "+dataProps);
-
-// String uri = olMgr.getIndividualURI("fd697ef3-cd95-3b49-82c8-e352fe63f320");
-// System.out.println("getIndividualURI : "+uri);
+ new ContextModelAnalyser("errwr").getBasicCtxModelStructure();
+ }
+}
-
-// String uri = olMgr.getNameAnnotationFromId("fd697ef3-cd95-3b49-82c8-e352fe63f320");
-// System.out.println("getNameAnnotationFromId : "+uri);
-
-// ArrayList<String> objProp = olMgr.getMultipleObjectPropertyFromIndividualAsStrings("0047f68b-7194-354a-958a-68cda6dbb2e8",
-// "http://timbus.teco.edu/ontologies/DSOs/CUDF.owl","hasDependency");
-// for( String str : objProp){
-// System.out.println("ObjectPropertyFromIndividual : "+str);
-// }
-
-// 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);
-
-// String dataProps = olMgr.getDataPropertyFromIndividual(name,
-// "http://timbus.teco.edu/ontologies/DSOs/DLLDSO.owl", "hasLocation");
-// System.out.println("dataProps->hasSourceLocation : "+dataProps);
-
- }
-// OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
-// OWLOntology ontology = manager.createOntology(IRI
-// .create("http://timbusproject.net/test"));
-// OWLNamedIndividual machineNode = createMachineNode(ontology,
-// new MachineID().getUUID());
-// System.out.println(machineNode);
- }
- private void printHashMap(HashMap<String, String> maps){
- System.out.println("Using EntrySet");
- for(Map.Entry<String, String> map : maps.entrySet()){
- System.out.println(map.getKey() +" :: "+ map.getValue());
- }
- }
-}