Added: 
incubator/stanbol/trunk/reengineer/xml/src/main/resources/META-INF/test/weather.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/reengineer/xml/src/main/resources/META-INF/test/weather.xml?rev=1087691&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/reengineer/xml/src/main/resources/META-INF/test/weather.xml
 (added)
+++ 
incubator/stanbol/trunk/reengineer/xml/src/main/resources/META-INF/test/weather.xml
 Fri Apr  1 13:01:38 2011
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<dwml version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:noNamespaceSchemaLocation="http://www.nws.noaa.gov/forecasts/xml/DWMLgen/schema/DWML.xsd";>
+<data>
+  <location>
+      <location-key>SanFrancisco</location-key>
+      <point latitude="37.47" longitude="122.26"/>
+  </location>
+  <time-layout time-coordinate="local" summarization="12hourly">
+      <layout-key>k-p12h-n14-3</layout-key>
+      <start-valid-time 
period-name="Today">2010-24-09T06:00:00-07:00</start-valid-time>
+      <end-valid-time>2010-24-09T18:00:00-07:00</end-valid-time>
+  </time-layout>
+  <parameters applicable-location="SanFrancisco">
+      <temperature type="maximum" units="Fahrenheit" 
time-layout="k-p12h-n14-3">
+        <name>Daily Maximum Temperature</name>
+        <value>38</value>
+      </temperature>
+      <temperature type="minimum" units="Fahrenheit" 
time-layout="k-p12h-n14-3">
+        <name>Daily Minimum Temperature</name>
+      </temperature>
+      <probability-of-precipitation type="12 hour" units="percent" 
time-layout="k-p12h-n14-3">
+        <name>12 Hourly Probability of Precipitation</name>
+        <value>27</value>
+      </probability-of-precipitation>
+      <weather time-layout="k-p12h-n14-3">
+        <name>Weather Type, Coverage, and Intensity</name>
+       <weather-conditions weather-summary="Mostly Cloudy"/>
+      </weather>
+  </parameters> 
+</data>
+</dwml>
\ No newline at end of file

Propchange: incubator/stanbol/trunk/reengineer/xml/src/main/resources/xerces/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 13:01:38 2011
@@ -0,0 +1 @@
+target

Added: 
incubator/stanbol/trunk/reengineer/xml/src/main/resources/xerces/xercesImpl-2.7.1.jar
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/reengineer/xml/src/main/resources/xerces/xercesImpl-2.7.1.jar?rev=1087691&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
incubator/stanbol/trunk/reengineer/xml/src/main/resources/xerces/xercesImpl-2.7.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Propchange: incubator/stanbol/trunk/reengineer/xml/src/test/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 13:01:38 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/reengineer/xml/src/test/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 13:01:38 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/reengineer/xml/src/test/java/org/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 13:01:38 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/reengineer/xml/src/test/java/org/apache/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 13:01:38 2011
@@ -0,0 +1 @@
+target

Propchange: 
incubator/stanbol/trunk/reengineer/xml/src/test/java/org/apache/stanbol/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 13:01:38 2011
@@ -0,0 +1 @@
+target

Propchange: 
incubator/stanbol/trunk/reengineer/xml/src/test/java/org/apache/stanbol/reengineer/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 13:01:38 2011
@@ -0,0 +1 @@
+target

Propchange: 
incubator/stanbol/trunk/reengineer/xml/src/test/java/org/apache/stanbol/reengineer/xml/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 13:01:38 2011
@@ -0,0 +1 @@
+target

Added: 
incubator/stanbol/trunk/reengineer/xml/src/test/java/org/apache/stanbol/reengineer/xml/XMLReengineerTest.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/reengineer/xml/src/test/java/org/apache/stanbol/reengineer/xml/XMLReengineerTest.java?rev=1087691&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/reengineer/xml/src/test/java/org/apache/stanbol/reengineer/xml/XMLReengineerTest.java
 (added)
+++ 
incubator/stanbol/trunk/reengineer/xml/src/test/java/org/apache/stanbol/reengineer/xml/XMLReengineerTest.java
 Fri Apr  1 13:01:38 2011
@@ -0,0 +1,102 @@
+package org.apache.stanbol.reengineer.xml;
+
+import java.io.InputStream;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.clerezza.rdf.core.access.WeightedTcProvider;
+import org.apache.clerezza.rdf.core.sparql.QueryEngine;
+import org.apache.clerezza.rdf.jena.sparql.JenaSparqlEngine;
+import org.apache.clerezza.rdf.simple.storage.SimpleTcProvider;
+import org.apache.stanbol.ontologymanager.ontonet.api.ONManager;
+import org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerImpl;
+import org.apache.stanbol.reengineer.base.api.DataSource;
+import org.apache.stanbol.reengineer.base.api.Reengineer;
+import org.apache.stanbol.reengineer.base.api.util.ReengineerType;
+import org.apache.stanbol.reengineer.base.impl.ReengineerManagerImpl;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLOntology;
+
+public class XMLReengineerTest {
+       
+       static DataSource dataSource;
+       static String graphNS;
+       static IRI outputIRI;
+       static Reengineer xmlExtractor;
+       
+       @BeforeClass
+       public static void setupClass() {
+               graphNS = "http://kres.iks-project.eu/reengineering/test";;
+               outputIRI = IRI.create(graphNS);
+               dataSource = new DataSource() {
+                       
+                       @Override
+                       public Object getDataSource() {
+                               InputStream xmlStream = 
this.getClass().getResourceAsStream(
+                                               "/META-INF/test/weather.xml");
+                               return xmlStream;
+                       }
+                       
+                       @Override
+                       public int getDataSourceType() {
+                               return ReengineerType.XML;
+                       }
+                       
+                       @Override
+                       public String getID() {
+                               // TODO Auto-generated method stub
+                               return null;
+                       }
+               };
+       }
+       
+       @Test
+       public void dataReengineeringTest() throws Exception {
+               OWLOntology schemaOntology = 
xmlExtractor.schemaReengineering(graphNS,
+                               outputIRI, dataSource);
+               xmlExtractor.dataReengineering(graphNS, 
IRI.create(outputIRI.toString()+"_new"), dataSource,
+                               schemaOntology);
+       }
+       
+       @Test
+       public void reengineeringTest() throws Exception {
+               xmlExtractor.reengineering(graphNS, outputIRI, dataSource);
+       }
+
+       @Test
+       public void schemaReengineeringTest() throws Exception {
+               xmlExtractor.schemaReengineering(graphNS, outputIRI, 
dataSource);
+               }
+
+       @Before
+       public void setup() {
+               Dictionary<String, Object> emptyConf = new Hashtable<String, 
Object>();
+               
+             class SpecialTcManager extends TcManager {
+                   public SpecialTcManager(QueryEngine qe, WeightedTcProvider 
wtcp) {
+                       super();
+                       bindQueryEngine(qe);
+                       bindWeightedTcProvider(wtcp);
+                   }
+               }
+
+               QueryEngine qe = new JenaSparqlEngine();
+               WeightedTcProvider wtcp = new SimpleTcProvider();
+               TcManager tcm = new SpecialTcManager(qe, wtcp);
+
+               // Two different ontology storagez, the same sparql engine and 
tcprovider
+               ONManager onManager = new ONManagerImpl(tcm, wtcp ,emptyConf);
+               xmlExtractor = new XMLExtractor(new ReengineerManagerImpl(tcm, 
wtcp),
+                               onManager, emptyConf);
+       }
+
+       @Before
+       public void tearDown() {
+               xmlExtractor = null;
+       }
+
+}


Reply via email to