how to create the SWRL built ins

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

how to create the SWRL built ins

Gennadie
Hi,

I am following this link (https://github.com/protegeproject/swrlapi-builtin-library-example) to create a simple built in atom about the comparaison between two strings. However, after I have generated the jar and put it in the plugin file of Protege, the "strings:stringsEqual" is not valid in Protege.

Below are my codes that are used to genetate the built ins:

public class SWRLBuiltInLibraryImpl extends AbstractSWRLBuiltInLibrary  
{
private static final String PREFIX = "strings";

private static final String NAMESPACE = "http://swrl.stanford.edu/ontologies/built-ins/5.2.0/strings#";
 
private static final String[] BUILT_IN_NAMES = { "stringsEqual" };
  public SWRLBuiltInLibraryImpl()
  {
    super(PREFIX, NAMESPACE, new HashSet<>(Arrays.asList(BUILT_IN_NAMES)));
  }
  
  @Override public void reset () { }
  
  public boolean stringEqualIgnoreCase(List<SWRLBuiltInArgument> arguments) 
   throws SWRLBuiltInException
{
  final int argument1Number = 0, argument2Number = 1, numberOfArguments = 2;
 
  checkNumberOfArgumentsEqualTo(numberOfArguments, arguments.size());
 
  String argument1 = getArgumentAsAString(argument1Number, arguments);
  String argument2 = getArgumentAsAString(argument2Number, arguments);
 
  return argument1.equalsIgnoreCase(argument2);
}
  }

Think you for your answers!

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user