Closed e-jajaga closed 8 years ago
The examples are out of date. (The create method now requires a prefix manager.)
I will update the examples later today.
In the meantime, take a look at:
I have updated the documentation to reflect the current API. I also added a quick start example to the README.
I changed the code as suggested by the Getting Started section but now I receive the following error:
java.lang.UnsupportedClassVersionError: org/swrlapi/exceptions/SWRLAPIException : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2625) at java.lang.Class.getMethod0(Class.java:2866) at java.lang.Class.getMethod(Class.java:1676) at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486) Exception in thread "main" Java Result: 1
Java 8 is required.
I am trying to fire SWRL rules through the SWRL API in NetBeans with your suggested code examples like follows:
InputStream ontologyPath = new FileInputStream("D:\swrlResultsUsage.owl"); OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLOntology ontology = manager.loadOntologyFromOntologyDocument(ontologyPath);
SWRLRuleEngine ruleEngine = SWRLAPIFactory.createSWRLRuleEngine(ontology); SWRLAPIRule rule = parser.parse("Person(?p) ^ hasAge(?p, ?age)" + " ^ swrlb:greaterThan(?age, 17) -> Adult(?p)"); ruleEngine.infer();
The compilation error on line "SWRLRuleEngine ruleEngine = .." says: "method createSWRLRuleEngine in class SWRLAPIFactory cannot be applied to given types"
Except OWL APIs, I have also referenced the required jars: swrl-api-1.0.0.jar, swrl-api-drools-engine1.0.0.jar but don't know where I am wrong.