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

org.swrlapi.drools.owl.properties.AP Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package org.swrlapi.drools.owl.properties;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.semanticweb.owlapi.model.OWLAnnotationProperty;
import org.swrlapi.builtins.arguments.SWRLBuiltInArgument;
import org.swrlapi.drools.extractors.DroolsOWLEntityExtractor;
import org.swrlapi.drools.extractors.DroolsSWRLBuiltInArgumentExtractor;
import org.swrlapi.drools.owl.core.OE;
import org.swrlapi.drools.swrl.BA;
import org.swrlapi.exceptions.TargetSWRLRuleEngineException;
import org.swrlapi.exceptions.TargetSWRLRuleEngineInternalException;

/**
 * This class represents an OWL annotation property.
 *
 * @see org.semanticweb.owlapi.model.OWLAnnotationProperty
 */
public class AP extends OE implements P
{
  private static final long serialVersionUID = 1L;

  public AP(@NonNull String propertyName)
  {
    super(propertyName);
  }

  /*
   * We have no way of anticipating the return types of built-ins in rules so we need to perform a runtime check.
   */
  public AP(@NonNull BA ba)
  {
    super("");

    if (ba instanceof AP) {
      AP p = (AP)ba;
      this.id = p.getName();
    } else
      throw new TargetSWRLRuleEngineInternalException(
        "expecting OWL annotation property for bound built-in argument, got " + ba.getClass().getCanonicalName());
  }

  @NonNull @Override public OWLAnnotationProperty extract(@NonNull DroolsOWLEntityExtractor extractor)
    throws TargetSWRLRuleEngineException
  {
    return extractor.extract(this);
  }

  @NonNull @Override public SWRLBuiltInArgument extract(@NonNull DroolsSWRLBuiltInArgumentExtractor extractor)
    throws TargetSWRLRuleEngineException
  {
    return extractor.extract(this);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy