java - Once I've written a builtin, what do I need to do to make the reasoners aware of it? -
I have written a custom biston to use in my project but I do not know how I can use it. I have written two classes, one of them is construction made by me (using I have already tried to use default bilitans, using written rules, which are used in Eclipse readable text files using Java. I have no problem in this matter. How can I use built Biltin? Do I need something (imported or included) in some files? First you Once you do this, you will actually use a rule that will reference to trigger your The output of this code will be: ... which we actually see: BaseBuiltin ) and in the second I have registered the new Biltin (using
BuiltinRegistry ) .
Builtin , typically
BaseBuiltin , And then you can use the
BuiltinRegistry.theRegistry.register (Builtin) as a rule-based conclusion.
Builtin . BuiltinRegistry.theRegistry.register (New BaseBeltin () {@Override public String getName ()} {return "example";} @ Override public zero head action (last node [] ARG, final Full length, final rule reference reference) {System.out.println ("Head Action:" + Arrays.toString (args));}}); The last string example: RuleString = "[mat1: (? S? P? O) \ n \ t-> Print (? S? P? O), \ n \ t example (? S? P? O) \ N] "+" "; Println (exampleRuleString); / * I use a fairly verbose syntax to make a strobe * to parse my rules * You can read from any of the other sources * / final list & lt; Rules & gt; Rule; Try (Last BufferedReader src = New BufferedReader (New InputStreamReader (New ByteArendup Stream (Example RuleString.getBytes ()))) {Rule = Rule. Similar rules (rule rules ParserFromReader (src)); } / * Associate the rules with and for the reason / final generic rules Reasoner Logicator = (GenericRUER) Generic rules ReasonerFactory.theInstance () Create (empty); Reasoner.setRules (rules); / * Create & amp; Prepare InfModel if you do not prepare, instead of being on the entry * model firing and estimation can not be decided. It might be * you * feel that your Builtin is not working, when it is. * / Last InfModel infModel = ModelFactory.createInfModel (Reason, ModelFactory.createDefaultModel ()); InfModel.prepare (); / * Add Triple to Graph: * [] rdf: Type rdfs: Class * / infModel.createResource (RDFS.Class);
Builtin
Builtin
[matte 1: (? S? P? O) - & gt; Print (? S? P? O), example (? S? P? O)] -2 -47400d: 14593 fc 1564: -7ffrd: type radians: class head action: [-2B 47400d: 14593fc 1564: -7FF, http: // www .w3.org / 1999/02/22-rdf-syntax-ns # type, http://www.w3.org/2000/01/rdf-schema#Class]
Comments
Post a Comment