Permalink
Browse files

Upgrade to empire 0.7.2, some minor bugfixes

  • Loading branch information...
1 parent 8c2812d commit 6cf253fcd0d37f7f13b94109600c0cd46caebb4e @sotty sotty committed Aug 1, 2012
@@ -38,10 +38,10 @@ public static TemplateRegistry getRegistry() {
public static void addTemplate( String path ) {
try {
InputStream stream = ResourceFactory.newClassPathResource( path, TemplateBuilder.class ).getInputStream();
-
+
getRegistry().addNamedTemplate( path.substring( path.lastIndexOf('/') + 1 ),
TemplateCompiler.compileTemplate(stream) );
-
+
} catch (IOException e) {
e.printStackTrace();
}
@@ -179,7 +179,7 @@ import org.jbpm.task.service.ContentData;
owner : String
@QuestionMark( type = Question.QuestionType.TYPE_TEXT, label = " Actor ", required = false )
- @AllowedAnswers( values = { } )
+ @AllowedAnswers( values = { "Default" } )
transition : String
@QuestionMark( type = Question.QuestionType.TYPE_TEXT, label = " Transition ", required = false )
@@ -31,12 +31,14 @@
import org.drools.io.ResourceFactory;
import org.drools.io.impl.ClassPathResource;
import org.drools.pmml_4_0.DroolsAbstractPMMLTest;
+import org.drools.pmml_4_0.ModelMarker;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.rule.Variable;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class NeuralNetworkTest extends DroolsAbstractPMMLTest {
@@ -185,6 +187,8 @@ public void testPTSD() throws Exception {
Assert.assertEquals( 0.2802, queryDoubleField("PTSD", "MockPTSD" ) );
+ assertEquals( 1, getKSession().getObjects( new ClassObjectFilter( ModelMarker.class) ).size() );
+
}
@@ -76,16 +76,26 @@
<dependency>
<groupId>com.clarkparsia</groupId>
<artifactId>Empire-core</artifactId>
- <version>0.7</version>
+ <version>0.7.2</version>
</dependency>
<dependency>
<groupId>com.clarkparsia</groupId>
<artifactId>Empire-sesame2</artifactId>
- <version>0.7</version>
+ <version>0.7.2</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.clarkparsia</groupId>
+ <artifactId>Empire-sesame2</artifactId>
+ <version>0.7.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openrdf.sesame</groupId>
+ <artifactId>sesame-rio-turtle</artifactId>
+ <version>2.3.0</version>
+ </dependency>
<dependency>
@@ -67,14 +67,14 @@
<dependency>
<groupId>com.clarkparsia</groupId>
<artifactId>Empire-core</artifactId>
- <version>0.7</version>
+ <version>0.7.2</version>
</dependency>
<dependency>
<groupId>com.clarkparsia</groupId>
<artifactId>Empire-sesame2</artifactId>
- <version>0.7</version>
+ <version>0.7.2</version>
<scope>test</scope>
</dependency>
@@ -71,7 +71,12 @@
<dependency>
<groupId>org.prefuse</groupId>
<artifactId>prefuse</artifactId>
- <version>beta-20060220</version>
+ <version>beta-20071021</version>
+ </dependency>
+ <dependency>
+ <groupId>jgraph</groupId>
+ <artifactId>jgraph</artifactId>
+ <version>5.13.0.0</version>
</dependency>
@@ -196,7 +196,7 @@ public OntoModel buildModel( String name, Resource res, StatefulKnowledgeSession
kSession );
results.setPackage( ontoDescr.getOntologyID().getOntologyIRI().toString() );
- results.setNamespace( ontoDescr.getOntologyID().getOntologyIRI().toString() +"#" );
+ results.setNamespace( ontoDescr.getOntologyID().getOntologyIRI().toString() );
return results;
}
@@ -178,7 +178,7 @@ public void testGraphModelGeneration() {
try {
// while (true) {
- Thread.sleep( 5000 );
+ Thread.sleep( 5000 );
// }
} catch (InterruptedException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
@@ -14,7 +14,7 @@
<dependency>
<groupId>com.clarkparsia</groupId>
<artifactId>Empire-core</artifactId>
- <version>0.7</version>
+ <version>0.7.2</version>
</dependency>
</dependencies>
@@ -1,9 +1,18 @@
package org.drools.semantics;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.adapters.XmlAdapter;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.lang.reflect.Constructor;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -14,7 +23,54 @@
public ReferenceAdapter() {
cache = new HashMap<String, UIdAble>();
+ }
+
+ public static Collection fromXMLResource( String sourceURL, String namespace ) {
+ try {
+ return fromXMLResource( new URL( sourceURL ), namespace );
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ return Collections.emptyList();
+ }
+ }
+ public static Collection fromXMLResource( URL source, String namespace ) {
+ try {
+ Unmarshaller unmarshal = JAXBContext.newInstance( namespace ).createUnmarshaller();
+ unmarshal.unmarshal( source.openStream() );
+ ReferenceAdapter loader = unmarshal.getAdapter( ReferenceAdapter.class );
+ return loader.getObjects();
+ } catch (JAXBException e) {
+ e.printStackTrace();
+ return Collections.emptyList();
+ } catch (IOException e) {
+ e.printStackTrace();
+ return Collections.emptyList();
+ }
+ }
+
+ public static Collection fromXMLStream( InputStream source, String namespace ) {
+ try {
+ Unmarshaller unmarshal = JAXBContext.newInstance( namespace ).createUnmarshaller();
+ unmarshal.unmarshal( source );
+ ReferenceAdapter loader = unmarshal.getAdapter( ReferenceAdapter.class );
+ return loader.getObjects();
+ } catch (JAXBException e) {
+ e.printStackTrace();
+ return Collections.emptyList();
+ }
+ }
+
+ public static Collection fromXMLString( String data, String namespace ) {
+ try {
+ Unmarshaller unmarshal = JAXBContext.newInstance( namespace ).createUnmarshaller();
+ unmarshal.unmarshal( new ByteArrayInputStream( data.getBytes() ) );
+ ReferenceAdapter loader = unmarshal.getAdapter( ReferenceAdapter.class );
+ return loader.getObjects();
+ } catch (JAXBException e) {
+ e.printStackTrace();
+ return Collections.emptyList();
+ }
}
public Collection getObjects() {
View
@@ -154,12 +154,6 @@
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>com.springsource.org.apache.commons.beanutils</artifactId>
- <version>1.8.0</version>
- </dependency>
-
- <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>

0 comments on commit 6cf253f

Please sign in to comment.