You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by sa...@apache.org on 2012/07/22 00:53:56 UTC

svn commit: r1364187 - /jena/trunk/jena-core/src/main/java/jena/schemagen.java

Author: sallen
Date: Sat Jul 21 22:53:55 2012
New Revision: 1364187

URL: http://svn.apache.org/viewvc?rev=1364187&view=rev
Log:
Fix broken schemagen.

Modified:
    jena/trunk/jena-core/src/main/java/jena/schemagen.java

Modified: jena/trunk/jena-core/src/main/java/jena/schemagen.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/main/java/jena/schemagen.java?rev=1364187&r1=1364186&r2=1364187&view=diff
==============================================================================
--- jena/trunk/jena-core/src/main/java/jena/schemagen.java (original)
+++ jena/trunk/jena-core/src/main/java/jena/schemagen.java Sat Jul 21 22:53:55 2012
@@ -741,31 +741,36 @@ public class schemagen {
     protected String getOntologyElementVersionInfo() {
         String versionInfo = null;
         
-        StmtIterator i = m_source.getBaseModel().listStatements( null, RDF.type, m_source.getProfile().ONTOLOGY() );
-        if (i.hasNext()) {
-            Resource ont = i.nextStatement().getSubject();
-            StmtIterator j = m_source.getBaseModel().listStatements( ont, OWL.versionInfo, (RDFNode)null );
-            if (j.hasNext()) {
-                versionInfo = j.nextStatement().getObject().asLiteral().getLexicalForm();
+        Resource ontologyClass = m_source.getProfile().ONTOLOGY();
+        if (null != ontologyClass) {
+            StmtIterator i = m_source.getBaseModel().listStatements( null, RDF.type, ontologyClass );
+            if (i.hasNext()) {
+                Resource ont = i.nextStatement().getSubject();
+                StmtIterator j = m_source.getBaseModel().listStatements( ont, OWL.versionInfo, (RDFNode)null );
+                if (j.hasNext()) {
+                    versionInfo = j.nextStatement().getObject().asLiteral().getLexicalForm();
+                    
+                    // check for ambiguous answers
+                    if (j.hasNext()) {
+                        System.err.println( "Warning: ambiguous owl:versionInfo - there are more than one owl:versionInfo statements." );
+                        System.err.println( "Picking first choice: " + versionInfo  + ". Other choices are:" );
+                        while (j.hasNext()) {
+                            System.err.print( " " );
+                            System.err.print( j.nextStatement().getObject().toString() );
+                        }
+                        System.err.println();
+                    }
+                }
                 
                 // check for ambiguous answers
-                if (j.hasNext()) {
+                if (i.hasNext()) {
                     System.err.println( "Warning: ambiguous owl:versionInfo - there is more than one owl:Ontology element." );
-                    System.err.println( "Picking first choice: " + versionInfo  + ". Other choices are:" );
-                    while (j.hasNext()) {
+                    System.err.println( "Picking first choice: " + ont.getURI()  + ". Other choices are:" );
+                    while (i.hasNext()) {
                         System.err.print( " " );
-                        System.err.print( j.nextStatement().getString() );
+                        System.err.print( i.nextStatement().getObject().toString() );
                     }
-                }
-            }
-            
-            // check for ambiguous answers
-            if (i.hasNext()) {
-                System.err.println( "Warning: ambiguous owl:versionInfo - there is more than one owl:Ontology element." );
-                System.err.println( "Picking first choice: " + ont.getURI()  + ". Other choices are:" );
-                while (i.hasNext()) {
-                    System.err.print( " " );
-                    System.err.print( i.nextStatement().getString() );
+                    System.err.println();
                 }
             }
         }