From 741e3ed188e63d100589e7c6dacfc742dd2e3849 Mon Sep 17 00:00:00 2001 From: vcelakp Date: Wed, 18 May 2016 21:55:49 +0200 Subject: [PATCH] schemagen M_MODEL is final + naming conventions --- jena-cmds/src/main/java/jena/schemagen.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/jena-cmds/src/main/java/jena/schemagen.java b/jena-cmds/src/main/java/jena/schemagen.java index 0512506b0d4..698cc7d2663 100644 --- a/jena-cmds/src/main/java/jena/schemagen.java +++ b/jena-cmds/src/main/java/jena/schemagen.java @@ -74,13 +74,13 @@ public class schemagen { public static final String DEFAULT_MARKER = "%"; /** Default template for writing out value declarations */ - public static final String DEFAULT_TEMPLATE = "public static final %valclass% %valname% = m_model.%valcreator%( \"%valuri%\" );"; + public static final String DEFAULT_TEMPLATE = "public static final %valclass% %valname% = M_MODEL.%valcreator%( \"%valuri%\" );"; /** Default template for writing out individual declarations */ - public static final String DEFAULT_INDIVIDUAL_TEMPLATE = "public static final %valclass% %valname% = m_model.%valcreator%( \"%valuri%\", %valtype% );"; + public static final String DEFAULT_INDIVIDUAL_TEMPLATE = "public static final %valclass% %valname% = M_MODEL.%valcreator%( \"%valuri%\", %valtype% );"; /** Default template for writing out individual declarations for non-ontology vocabularies */ - public static final String DEFAULT_RDFS_INDIVIDUAL_TEMPLATE = "public static final %valclass% %valname% = m_model.%valcreator%( \"%valuri%\" );"; + public static final String DEFAULT_RDFS_INDIVIDUAL_TEMPLATE = "public static final %valclass% %valname% = M_MODEL.%valcreator%( \"%valuri%\" );"; /** Default template for the file header */ public static final String DEFAULT_HEADER_TEMPLATE = "/* CVS $" + "Id: $ */%nl%%package% %nl%%imports% %nl%/**%nl% * Vocabulary definitions from %sourceURI% %nl% * @author Auto-generated by schemagen on %date% %nl% */"; @@ -603,11 +603,11 @@ protected void writeModelDeclaration() { lang = "RDFS"; } writeln( 1, "/**

The ontology model that holds the vocabulary terms

*/" ); - writeln( 1, "private static OntModel m_model = ModelFactory.createOntologyModel( OntModelSpec." + lang + "_MEM, null );" ); + writeln( 1, "private static final OntModel M_MODEL = ModelFactory.createOntologyModel( OntModelSpec." + lang + "_MEM, null );" ); } else { writeln( 1, "/**

The RDF model that holds the vocabulary terms

*/" ); - writeln( 1, "private static Model m_model = ModelFactory.createDefaultModel();" ); + writeln( 1, "private static final Model M_MODEL = ModelFactory.createDefaultModel();" ); } writeln( 1 ); @@ -646,7 +646,7 @@ protected void writeSource() { writeln( 0, "" ); writeln( 1, "/** Read the ontology definition into the source model */ " ); writeln( 1, "static { " ); - writeln( 2, "m_model.read( new ByteArrayInputStream( SOURCE.getBytes() ), null, \"N3\" );" ); + writeln( 2, "M_MODEL.read( new ByteArrayInputStream( SOURCE.getBytes() ), null, \"N3\" );" ); writeln( 1, "}" ); writeln( 0, "" ); } @@ -677,12 +677,13 @@ protected void writeNamespace() { writeln( 1 ); writeln( 1, "/**

The namespace of the vocabulary as a string

" ); - writeln( 1, " * @see #NS */" ); + writeln( 1, " * @return namespace as String" ); + writeln( 1, " * @see #NS */" ); writeln( 1, "public static String getURI() {return NS;}" ); writeln( 1 ); writeln( 1, "/**

The namespace of the vocabulary as a resource

*/" ); - writeln( 1, "public static final Resource NAMESPACE = m_model.createResource( NS );" ); + writeln( 1, "public static final Resource NAMESPACE = M_MODEL.createResource( NS );" ); writeln( 1 ); } @@ -1015,7 +1016,7 @@ protected void writeOntIndividuals() { if (cls == null) { cls = OWL.Thing; } String varName = m_resourcesToNames.get( cls ); - String valType = (varName != null) ? varName : "m_model.createClass( \"" + cls.getURI() + "\" )"; + String valType = (varName != null) ? varName : "M_MODEL.createClass( \"" + cls.getURI() + "\" )"; // push the individuals type onto the stack addReplacementPattern( "valtype", valType );