Skip to content

Package: OWL2JavaMojo

OWL2JavaMojo

nameinstructionbranchcomplexitylinemethod
OWL2JavaMojo()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
execute()
M: 122 C: 0
0%
M: 12 C: 0
0%
M: 7 C: 0
0%
M: 16 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: * Copyright (C) 2016 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jopa.maven;
16:
17: import cz.cvut.kbss.jopa.owl2java.OWL2JavaTransformer;
18: import org.apache.maven.plugin.AbstractMojo;
19: import org.apache.maven.plugin.MojoExecutionException;
20: import org.apache.maven.plugin.MojoFailureException;
21: import org.apache.maven.plugins.annotations.Mojo;
22: import org.apache.maven.plugins.annotations.Parameter;
23:
24: @Mojo( name = "owl2java-transform" )
25: public class OWL2JavaMojo extends AbstractMojo {
26:
27: @Parameter(alias="mapping-file")
28: private String pMappingFile;
29:
30: @Parameter(alias="package")
31: private String pPackage;
32:
33: @Parameter(alias = "context-name")
34: private String pContextName;
35:
36: @Parameter(alias = "ontology-iri")
37: private String pOntologyIRI;
38:
39: @Parameter(alias = "output-directory")
40: private String pOutputDirectory;
41:
42: @Parameter(alias = "with-owlapi",defaultValue = "false")
43: private Boolean pWithOWLAPI;
44:
45: @Parameter(alias = "whole-ontology-as-ics",defaultValue = "false")
46: private Boolean pWholeOntologyAsICS;
47:
48: @Parameter(alias = "vocabulary-only",defaultValue = "false")
49: private Boolean pVocabularyOnly;
50:
51: @Override
52: public void execute() throws MojoExecutionException, MojoFailureException {
53: OWL2JavaTransformer owl2java = new OWL2JavaTransformer();
54:
55: System.out.println(pWholeOntologyAsICS + ","
56: + pMappingFile + ","
57: + pPackage + ","
58: + pContextName + ","
59: + pOntologyIRI + ","
60: + pOutputDirectory + ","
61: + pVocabularyOnly + ","
62: );
63:
64:• if ( pOntologyIRI == null ) {
65: getLog().error("The parameter 'ontology-iri' is invalid. Must not be null.");
66: getLog().error("Skipping OWL2Java transformation.");
67: return;
68: }
69:
70:• if ( pMappingFile != null && !pMappingFile.isEmpty() ) {
71: owl2java.setOntology(pOntologyIRI, pMappingFile, true);
72: } else {
73: owl2java.setOntology(pOntologyIRI, null, true);
74: }
75:
76:• if ( pVocabularyOnly ) {
77:• owl2java.generateVocabulary(pWholeOntologyAsICS ? null : pContextName,
78: pPackage, pOutputDirectory, pWithOWLAPI);
79: } else {
80:• owl2java.transform(pWholeOntologyAsICS ? null : pContextName,
81: pPackage, pOutputDirectory, pWithOWLAPI);
82: }
83:
84: getLog().info( "OWL2Java successfully generated!" );
85: }
86: }