Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
Bringing in eql projects.
Browse files Browse the repository at this point in the history
  • Loading branch information
jzonthemtn committed Mar 21, 2024
1 parent 6116294 commit 9dcba51
Show file tree
Hide file tree
Showing 43 changed files with 822 additions and 715 deletions.
4 changes: 2 additions & 2 deletions entitydb-entity-store/entitydb-entity-store-dynamodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@
<version>${commons.lang.version}</version>
</dependency>
<dependency>
<groupId>com.mtnfog</groupId>
<groupId>cai.philterd.entitydb</groupId>
<artifactId>eql-language</artifactId>
<version>${eql.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
Expand Down
4 changes: 2 additions & 2 deletions entitydb-entity-store/entitydb-entity-store-rdbms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
<version>${commons.collections.version}</version>
</dependency>
<dependency>
<groupId>com.mtnfog</groupId>
<groupId>ai.philterd</groupId>
<artifactId>eql-language</artifactId>
<version>${eql.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
Expand Down
32 changes: 9 additions & 23 deletions entitydb-eql/eql-filters/pom.xml
Original file line number Diff line number Diff line change
@@ -1,39 +1,19 @@
<?xml version="1.0"?>
<!--
Copyright 2019 Mountain Fog, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy
of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>ai.idylnlp</groupId>
<groupId>ai.philterd.entitydb</groupId>
<artifactId>eql</artifactId>
<version>1.3.0-SNAPSHOT</version>
<version>0.1-SNAPSHOT</version>
</parent>
<artifactId>eql-filters</artifactId>
<name>eql-filters</name>
<dependencies>
<dependency>
<groupId>ai.idylnlp</groupId>
<groupId>ai.philterd.entitydb</groupId>
<artifactId>eql-language</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ai.idylnlp</groupId>
<artifactId>idylnlp-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
Expand All @@ -48,5 +28,11 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>ai.philterd.entitydb</groupId>
<artifactId>entitydb-model</artifactId>
<version>0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright 2024 Philterd, LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package ai.philterd.entitydb.eql.filters;

import org.apache.commons.lang3.StringUtils;

public enum DateComparison {

BEFORE("before"), AFTER("after");

private String dateComparison;

private DateComparison(String dateComparison) {

this.dateComparison = dateComparison;

}

/**
* Gets the enumeration from a string value.
* @param dateComparison The value to look up.
* @return A {@link DateComparison comparison}.
*/
public static DateComparison fromValue(String dateComparison) {

if(StringUtils.isNotEmpty(dateComparison)) {

for (DateComparison d : DateComparison.values()) {

if (dateComparison.equalsIgnoreCase(d.getDateComparison())) {
return d;
}

}

}

throw new IllegalArgumentException("No date comparison found with value: " + dateComparison);

}

@Override
public String toString() {

return dateComparison;

}

public String getDateComparison() {

return dateComparison;

}

}
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
/*******************************************************************************
* Copyright 2019 Mountain Fog, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
******************************************************************************/
/*
* (C) Copyright 2017 Mountain Fog, Inc.
* Copyright 2024 Philterd, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package ai.idylnlp.eql.filters;
package ai.philterd.entitydb.eql.filters;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -37,16 +27,14 @@
import java.util.LinkedList;
import java.util.List;

import ai.philterd.entitydb.eql.Eql;
import ai.philterd.entitydb.model.exceptions.QueryGenerationException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import ai.idylnlp.eql.Eql;
import ai.idylnlp.eql.exceptions.QueryGenerationException;
import ai.idylnlp.eql.filters.comparisons.DateComparison;
import ai.idylnlp.eql.model.EntityQuery;
import ai.idylnlp.model.entity.Entity;
import ai.philterd.entitydb.model.entity.Entity;

/**
* Static functions for applying EQL statements to entities.
Expand Down Expand Up @@ -139,7 +127,6 @@ public static Collection<Entity> filterEntities(Collection<Entity> entities, Dat
* @param entities The collection of entities.
* @param targetDate The target date.
* @param minutes The size of the window in minutes.
* @param value The size of the window.
* @return A filtered collection of date entities that exist in the given window.
*/
public static Collection<Entity> filterEntities(Collection<Entity> entities, Date targetDate, int minutes) {
Expand Down Expand Up @@ -229,7 +216,7 @@ public static Collection<Entity> filterEntities(Collection<Entity> entities, Lis

} else {

EntityQuery entityQuery = Eql.generate(eql);
final EntityQuery entityQuery = Eql.generate(eql);

if(!universalMatch) {

Expand All @@ -253,7 +240,7 @@ public static Collection<Entity> filterEntities(Collection<Entity> entities, Lis
}

// If it is a universalMatch we return all entities.
// Otherwise we just return the entities that matched at least one EQL statement.
// Otherwise, we just return the entities that matched at least one EQL statement.

if(universalMatch) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ai.idylnlp.test.eql.filters;
package ai.philterd.entitydb.test.eql.filters;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand All @@ -43,9 +43,9 @@

import org.junit.Test;

import ai.idylnlp.eql.filters.EqlFilters;
import ai.idylnlp.eql.filters.comparisons.DateComparison;
import ai.idylnlp.model.entity.Entity;
import ai.philterd.entitydb.eql.filters.EqlFilters;
import ai.philterd.entitydb.eql.filters.DateComparison;
import ai.philterd.entitydb.model.entity.Entity;

public class EqlFiltersTest {

Expand Down
Loading

0 comments on commit 9dcba51

Please sign in to comment.