org.swrlapi.drools.converters.oo.DroolsOWLIndividual2IConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swrlapi-drools-engine Show documentation
Show all versions of swrlapi-drools-engine Show documentation
Drools implementation of SWRLAPI-based SWRL rule engine
package org.swrlapi.drools.converters.oo;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLIndividual;
import org.swrlapi.bridge.SWRLRuleEngineBridge;
import org.swrlapi.bridge.converters.TargetRuleEngineConverterBase;
import org.swrlapi.bridge.converters.TargetRuleEngineOWLIndividualConverter;
import org.swrlapi.drools.owl.individuals.I;
/**
* Converts an OWLAPI OWL individual to a Drools individual represented by the class
* {@link I}.
*
* @see org.semanticweb.owlapi.model.OWLIndividual
* @see org.semanticweb.owlapi.model.OWLAnonymousIndividual
* @see org.semanticweb.owlapi.model.OWLNamedIndividual
* @see I
*/
public class DroolsOWLIndividual2IConverter extends TargetRuleEngineConverterBase
implements TargetRuleEngineOWLIndividualConverter
{
public DroolsOWLIndividual2IConverter(@NonNull SWRLRuleEngineBridge bridge)
{
super(bridge);
}
@NonNull @Override public I convert(@NonNull OWLIndividual individual)
{
if (individual.isNamed()) {
IRI individualIRI = individual.asOWLNamedIndividual().getIRI();
String individualPrefixedName = iri2PrefixedName(individualIRI);
return new I(individualPrefixedName);
} else
return new I(individual.asOWLAnonymousIndividual().getID().getID());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy