Search in sources :

Example 1 with URIEntity

use of org.kie.kogito.explainability.local.counterfactual.entities.URIEntity in project kogito-apps by kiegroup.

the class CounterfactualEntityFactoryTest method testURIFactory.

@Test
void testURIFactory() throws URISyntaxException {
    final URI value = URI.create("./");
    Feature feature = FeatureFactory.newURIFeature("uri-feature", value);
    CounterfactualEntity counterfactualEntity = CounterfactualEntityFactory.from(feature);
    assertTrue(counterfactualEntity instanceof FixedURIEntity);
    assertEquals(Type.URI, counterfactualEntity.asFeature().getType());
    FeatureDomain domain = URIFeatureDomain.create(new URI("./"), new URI("../"), new URI("https://example.com"));
    feature = FeatureFactory.newURIFeature("uri-feature", value, domain);
    counterfactualEntity = CounterfactualEntityFactory.from(feature);
    assertTrue(counterfactualEntity instanceof URIEntity);
    assertEquals(value, counterfactualEntity.asFeature().getValue().getUnderlyingObject());
    domain = URIFeatureDomain.create(List.of(new URI("./"), new URI("../"), new URI("https://example.com")));
    feature = FeatureFactory.newURIFeature("uri-feature", value, domain);
    counterfactualEntity = CounterfactualEntityFactory.from(feature);
    assertTrue(counterfactualEntity instanceof URIEntity);
    assertEquals(value, counterfactualEntity.asFeature().getValue().getUnderlyingObject());
    domain = URIFeatureDomain.create(Set.of(new URI("./"), new URI("../"), new URI("https://example.com")));
    feature = FeatureFactory.newURIFeature("uri-feature", value, domain);
    counterfactualEntity = CounterfactualEntityFactory.from(feature);
    assertTrue(counterfactualEntity instanceof URIEntity);
    assertEquals(value, counterfactualEntity.asFeature().getValue().getUnderlyingObject());
}
Also used : CounterfactualEntity(org.kie.kogito.explainability.local.counterfactual.entities.CounterfactualEntity) ObjectFeatureDomain(org.kie.kogito.explainability.model.domain.ObjectFeatureDomain) EmptyFeatureDomain(org.kie.kogito.explainability.model.domain.EmptyFeatureDomain) CategoricalFeatureDomain(org.kie.kogito.explainability.model.domain.CategoricalFeatureDomain) CurrencyFeatureDomain(org.kie.kogito.explainability.model.domain.CurrencyFeatureDomain) URIFeatureDomain(org.kie.kogito.explainability.model.domain.URIFeatureDomain) DurationFeatureDomain(org.kie.kogito.explainability.model.domain.DurationFeatureDomain) TimeFeatureDomain(org.kie.kogito.explainability.model.domain.TimeFeatureDomain) NumericalFeatureDomain(org.kie.kogito.explainability.model.domain.NumericalFeatureDomain) BinaryFeatureDomain(org.kie.kogito.explainability.model.domain.BinaryFeatureDomain) FeatureDomain(org.kie.kogito.explainability.model.domain.FeatureDomain) URI(java.net.URI) Feature(org.kie.kogito.explainability.model.Feature) URIEntity(org.kie.kogito.explainability.local.counterfactual.entities.URIEntity) FixedURIEntity(org.kie.kogito.explainability.local.counterfactual.entities.fixed.FixedURIEntity) FixedURIEntity(org.kie.kogito.explainability.local.counterfactual.entities.fixed.FixedURIEntity) Test(org.junit.jupiter.api.Test)

Aggregations

URI (java.net.URI)1 Test (org.junit.jupiter.api.Test)1 CounterfactualEntity (org.kie.kogito.explainability.local.counterfactual.entities.CounterfactualEntity)1 URIEntity (org.kie.kogito.explainability.local.counterfactual.entities.URIEntity)1 FixedURIEntity (org.kie.kogito.explainability.local.counterfactual.entities.fixed.FixedURIEntity)1 Feature (org.kie.kogito.explainability.model.Feature)1 BinaryFeatureDomain (org.kie.kogito.explainability.model.domain.BinaryFeatureDomain)1 CategoricalFeatureDomain (org.kie.kogito.explainability.model.domain.CategoricalFeatureDomain)1 CurrencyFeatureDomain (org.kie.kogito.explainability.model.domain.CurrencyFeatureDomain)1 DurationFeatureDomain (org.kie.kogito.explainability.model.domain.DurationFeatureDomain)1 EmptyFeatureDomain (org.kie.kogito.explainability.model.domain.EmptyFeatureDomain)1 FeatureDomain (org.kie.kogito.explainability.model.domain.FeatureDomain)1 NumericalFeatureDomain (org.kie.kogito.explainability.model.domain.NumericalFeatureDomain)1 ObjectFeatureDomain (org.kie.kogito.explainability.model.domain.ObjectFeatureDomain)1 TimeFeatureDomain (org.kie.kogito.explainability.model.domain.TimeFeatureDomain)1 URIFeatureDomain (org.kie.kogito.explainability.model.domain.URIFeatureDomain)1