All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.swrlapi.bridge.converters.TargetRuleEngineConverterBase Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package org.swrlapi.bridge.converters;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.semanticweb.owlapi.model.IRI;
import org.swrlapi.bridge.SWRLRuleEngineBridge;

import java.util.Optional;

/**
 * This interface provides gives target rule engines the ability to resolve an IRI to a prefixed name.
 */
public abstract class TargetRuleEngineConverterBase implements TargetRuleEngineConverter
{
  @NonNull private final SWRLRuleEngineBridge bridge;

  protected TargetRuleEngineConverterBase(@NonNull SWRLRuleEngineBridge bridge)
  {
    this.bridge = bridge;
  }

  @NonNull protected String iri2PrefixedName(IRI iri)
  {
    Optional<@NonNull String> prefixedName = this.bridge.getIRIResolver().iri2PrefixedName(iri);

    if (prefixedName.isPresent())
      return prefixedName.get();
    else
      throw new IllegalArgumentException("could not get prefixed name for IRI " + iri);
  }

  @NonNull protected SWRLRuleEngineBridge getBridge()
  {
    return this.bridge;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy