Skip to content

Commit

Permalink
Merged version 1.6.6
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Oct 2, 2024
2 parents d70d3e8 + 1856bae commit eb9d5c7
Show file tree
Hide file tree
Showing 30 changed files with 996 additions and 245 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ Java Class Model API for Predictive Model Markup Language (PMML).

JPMML-Model library JAR files (together with accompanying Java source and Javadocs JAR files) are released via [Maven Central Repository](https://repo1.maven.org/maven2/org/jpmml/).

The current version is **1.6.5** (24 June, 2024).
The current version is **1.6.6** (1 October, 2024).

```xml
<dependency>
<groupId>org.jpmml</groupId>
<artifactId>pmml-model</artifactId>
<version>1.6.5</version>
<version>1.6.6</version>
</dependency>
```

Expand Down
3 changes: 0 additions & 3 deletions pmml-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<archive>
<manifestEntries>
Expand All @@ -48,7 +47,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<goals>
Expand All @@ -74,7 +72,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.23</version>
<configuration>
<skip>true</skip>
</configuration>
Expand Down
3 changes: 1 addition & 2 deletions pmml-model-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,14 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
<version>3.1.3</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<goals>
Expand Down
2 changes: 1 addition & 1 deletion pmml-model-gwt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.7.1</version>
<version>3.8.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
Expand Down
1 change: 0 additions & 1 deletion pmml-model-kryo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<argLine>--add-opens=java.xml/org.xml.sax.helpers=ALL-UNNAMED</argLine>
</configuration>
Expand Down
1 change: 0 additions & 1 deletion pmml-model-metro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.23</version>
<configuration>
<skip>true</skip>
</configuration>
Expand Down
1 change: 0 additions & 1 deletion pmml-model-moxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.23</version>
<configuration>
<skip>true</skip>
</configuration>
Expand Down
15 changes: 8 additions & 7 deletions pmml-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -117,7 +116,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<argLine>-javaagent:${basedir}/../pmml-agent/target/agent-${project.version}.jar=public=true ${jacoco.agent}</argLine>
</configuration>
Expand Down Expand Up @@ -187,14 +185,18 @@
<args>
<arg>-no-header</arg>
<arg>-npa</arg>
<arg>-Xannotate</arg>
<arg>-XcopyConstructor</arg>
<!-- Update class hierarchy -->
<arg>-Xinheritance</arg>
<arg>-Xjackson</arg>
<arg>-Xno-javadoc</arg>
<arg>-Xpmml</arg>
<!-- Annotate default types and members (annotation order: JAXB, Jackson, JPMML) -->
<arg>-Xjackson</arg>
<arg>-Xannotate</arg>
<!-- Add custom types and members -->
<arg>-XcopyConstructor</arg>
<arg>-XvalueConstructor</arg>
<arg>-Xvisitor</arg>
<!-- Cleanup -->
<arg>-Xno-javadoc</arg>
</args>
<episode>false</episode>
<extension>true</extension>
Expand Down Expand Up @@ -224,7 +226,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<argLine>-javaagent:${basedir}/../pmml-agent/target/agent-${project.version}.jar=public=true --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED ${jacoco.agent}</argLine>
</configuration>
Expand Down
49 changes: 43 additions & 6 deletions pmml-model/src/main/java/org/dmg/pmml/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,52 @@
package org.dmg.pmml;

public enum Version {
PMML_3_0("http://www.dmg.org/PMML-3_0"),
PMML_3_0("http://www.dmg.org/PMML-3_0"){

@Override
public Version previous(){
return null;
}
},
PMML_3_1("http://www.dmg.org/PMML-3_1"),
PMML_3_2("http://www.dmg.org/PMML-3_2"),
PMML_4_0("http://www.dmg.org/PMML-4_0"),
PMML_4_1("http://www.dmg.org/PMML-4_1"),
PMML_4_2("http://www.dmg.org/PMML-4_2"),
PMML_4_3("http://www.dmg.org/PMML-4_3"),
PMML_4_4("http://www.dmg.org/PMML-4_4"),
PMML_4_4("http://www.dmg.org/PMML-4_4"){

@Override
public Version next(){
return null;
}
},

/**
* Extended PMML
*/
XPMML("http://xpmml.org/XPMML"){

@Override
public boolean isStandard(){
return false;
}

@Override
public String getVersion(){
throw new UnsupportedOperationException();
}
}

@Override
public Version previous(){
return null;
}

@Override
public Version next(){
return null;
}
},
;

private String namespaceURI = null;
Expand All @@ -33,9 +60,7 @@ private Version(String namespaceURI){
}

public boolean isStandard(){
String namespaceURI = getNamespaceURI();

return namespaceURI.matches(Version.REGEX_PMML_XMLNS);
return true;
}

public String getNamespaceURI(){
Expand All @@ -54,6 +79,18 @@ public String getVersion(){
return version.replace('_', '.');
}

public Version previous(){
Version[] versions = Version.values();

return versions[ordinal() - 1];
}

public Version next(){
Version[] versions = Version.values();

return versions[ordinal() + 1];
}

static
public Version getMinimum(){
Version[] versions = Version.values();
Expand Down
95 changes: 95 additions & 0 deletions pmml-model/src/main/java/org/dmg/pmml/VersionUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Copyright (c) 2024 Villu Ruusmann
*/
package org.dmg.pmml;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class VersionUtil {

private VersionUtil(){
}

static
public int compare(int[] left, int[] right){

for(int i = 0, max = Math.max(left.length, right.length); i < max; i++){
int diff = Integer.compare(left[i], right[i]);

if(diff != 0){
return diff;
}
}

return 0;
}

static
public int compare(String left, String right){
return compare(parse(left), parse(right));
}

static
public int[] parse(String string){
StringTokenizer st = new StringTokenizer(string, ".");

int[] result = new int[st.countTokens()];

for(int i = 0; st.hasMoreTokens(); i++){
result[i] = Integer.parseInt(st.nextToken());
}

return result;
}

static
public Version getVersion(String function){
return VersionUtil.functionVersions.get(function);
}

private static Map<String, Version> functionVersions = new LinkedHashMap<>();

static {
declareFunctions(Version.PMML_3_0,
PMMLFunctions.ADD, PMMLFunctions.SUBTRACT, PMMLFunctions.MULTIPLY, PMMLFunctions.DIVIDE,
PMMLFunctions.MIN, PMMLFunctions.MAX, PMMLFunctions.SUM, PMMLFunctions.AVG,
PMMLFunctions.LOG10, PMMLFunctions.LN, PMMLFunctions.SQRT, PMMLFunctions.ABS,
PMMLFunctions.UPPERCASE, PMMLFunctions.SUBSTRING, PMMLFunctions.TRIMBLANKS,
PMMLFunctions.FORMATNUMBER, PMMLFunctions.FORMATDATETIME,
PMMLFunctions.DATEDAYSSINCEYEAR, PMMLFunctions.DATESECONDSSINCEYEAR, PMMLFunctions.DATESECONDSSINCEMIDNIGHT);
declareFunctions(Version.PMML_3_1,
PMMLFunctions.EXP, PMMLFunctions.POW, PMMLFunctions.THRESHOLD, PMMLFunctions.FLOOR, PMMLFunctions.CEIL, PMMLFunctions.ROUND);
declareFunctions(Version.PMML_4_0,
PMMLFunctions.ISMISSING, PMMLFunctions.ISNOTMISSING,
PMMLFunctions.EQUAL, PMMLFunctions.NOTEQUAL, PMMLFunctions.LESSTHAN, PMMLFunctions.LESSOREQUAL, PMMLFunctions.GREATERTHAN, PMMLFunctions.GREATEROREQUAL,
PMMLFunctions.AND, PMMLFunctions.OR,
PMMLFunctions.NOT,
PMMLFunctions.ISIN, PMMLFunctions.ISNOTIN,
PMMLFunctions.IF);
declareFunctions(Version.PMML_4_1,
PMMLFunctions.MEDIAN, PMMLFunctions.PRODUCT,
PMMLFunctions.LOWERCASE);
declareFunctions(Version.PMML_4_2,
PMMLFunctions.CONCAT, PMMLFunctions.REPLACE, PMMLFunctions.MATCHES);
declareFunctions(Version.PMML_4_3,
PMMLFunctions.NORMALCDF, PMMLFunctions.NORMALPDF, PMMLFunctions.STDNORMALCDF, PMMLFunctions.STDNORMALPDF, PMMLFunctions.ERF, PMMLFunctions.NORMALIDF, PMMLFunctions.STDNORMALIDF);
declareFunctions(Version.PMML_4_4,
PMMLFunctions.MODULO,
PMMLFunctions.ISVALID, PMMLFunctions.ISNOTVALID,
PMMLFunctions.EXPM1, PMMLFunctions.HYPOT, PMMLFunctions.LN1P, PMMLFunctions.RINT,
PMMLFunctions.STRINGLENGTH,
PMMLFunctions.SIN, PMMLFunctions.ASIN, PMMLFunctions.SINH, PMMLFunctions.COS, PMMLFunctions.ACOS, PMMLFunctions.COSH, PMMLFunctions.TAN, PMMLFunctions.ATAN, PMMLFunctions.TANH);
declareFunctions(Version.XPMML,
PMMLFunctions.ATAN2);
}

static
private void declareFunctions(Version version, String... functions){

for(String function : functions){
VersionUtil.functionVersions.put(function, version);
}
}
}
20 changes: 20 additions & 0 deletions pmml-model/src/main/java/org/jpmml/model/annotations/Since.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2024 Villu Ruusmann
*/
package org.jpmml.model.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention (
value = RetentionPolicy.RUNTIME
)
@Target (
value = {ElementType.TYPE, ElementType.FIELD}
)
public @interface Since {

String value();
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,15 @@ public String getNamespaceURI(){
}

private void setNamespaceURI(String namespaceURI){

if(namespaceURI == null){
throw new NullPointerException();
}

this.namespaceURI = namespaceURI;
this.namespaceURI = Objects.requireNonNull(namespaceURI);
}

public String getLocalName(){
return this.localName;
}

private void setLocalName(String localName){

if(localName == null){
throw new NullPointerException();
}

this.localName = localName;
this.localName = Objects.requireNonNull(localName);
}

static
Expand Down
Loading

0 comments on commit eb9d5c7

Please sign in to comment.