You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by co...@apache.org on 2011/03/10 09:26:07 UTC

svn commit: r1080150 - /incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XSDExtractor.java

Author: concelvio
Date: Thu Mar 10 08:26:07 2011
New Revision: 1080150

URL: http://svn.apache.org/viewvc?rev=1080150&view=rev
Log:
STANBOL-98:
1) To solve the exception "org.apache.xerces.impl.dv.DatatypeException: Whitespace facet value is not available for the union simpleType 'numberValueListType'" has been added in catch block the expression to add the simple type with PRESERVE oprion:
    manager.applyChange(new AddAxiom(schemaOntology, createOWLObjectPropertyAssertionAxiom(factory, XSD_OWL.hasWhitespace, simpleType, XSD_OWL.PRESERVE)));

Modified:
    incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XSDExtractor.java

Modified: incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XSDExtractor.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XSDExtractor.java?rev=1080150&r1=1080149&r2=1080150&view=diff
==============================================================================
--- incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XSDExtractor.java (original)
+++ incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XSDExtractor.java Thu Mar 10 08:26:07 2011
@@ -397,6 +397,9 @@ public class XSDExtractor extends Semion
 
 		try {
 			//Whitepace
+                        /* This line, sometimes, generates an exception when try to get simple type definition for white space.
+                                However, even if there is the exception, the line returns the ZERO value, so in the catch block is perfomed the
+                                option with ZERO value that is WS_PRESERVE.*/
 			short whitespace = xsSimpleTypeDefinition.getWhitespace();
 			if(whitespace == XSSimpleTypeDecl.WS_COLLAPSE){
 				//Collapse
@@ -414,7 +417,9 @@ public class XSDExtractor extends Semion
 			log.info("WHITESPACE : "+whitespace);
 		} catch (DatatypeException e) {
 			// TODO Auto-generated catch block
-			e.printStackTrace();
+                        /*In case of exception is run the option that preserves the simple type.*/
+                        manager.applyChange(new AddAxiom(schemaOntology, createOWLObjectPropertyAssertionAxiom(factory, XSD_OWL.hasWhitespace, simpleType, XSD_OWL.PRESERVE)));
+			log.warn("PROBLEM TO GET WHITE SPACE FROM SIMPLE TYPE DEFINITION", e);
 		}
 		
 		
@@ -527,6 +532,7 @@ public class XSDExtractor extends Semion
 		};
 		
 		PSVIDocumentImpl psviDocumentImpl = new PSVIDocumentImpl();
+        XSSimpleTypeDecl m;
 		if(dataSource != null){
 			
 			OWLOntologyManager ontologyManager = onManager.getOwlCacheManager();		
@@ -630,7 +636,8 @@ public class XSDExtractor extends Semion
 								if(baseType == XSTypeDefinition.SIMPLE_TYPE){
 									log.info("SIMPLE TYPE");
 									typeResource = createOWLClassAssertionAxiom(factory, XSD_OWL.SimpleType, typeIRI);
-									addSimpleType(graphNS, ontologyManager, factory, dataSourceSchemaOntology, typeIRI, (XSSimpleTypeDecl) xsTypeDefinition);
+                                                                        addSimpleType(graphNS, ontologyManager, factory, dataSourceSchemaOntology, typeIRI, (XSSimpleTypeDecl) xsTypeDefinition);
+                                                                       
 								}
 								else {
 									System.out.println("COMPLEX TYPE");