简体   繁体   中英

Framework combining capabilities of Apache Jena and Prolog for handling production rules, triples

The question seems to be slight open-ended. I am in the process of handling rules (mostly production rules) with arithmetic operators. I also have an ontology which defines relationships between elements of these rules (This is atleast the inital setup). Eg

Trivial Example

Facts

NoOfItems('100')
BaseRental('300')

Production Rule

Profit = (NoOfUnits * ProductionCostPerUnit) + TransportationCost - (NoOfUnits * SellingPricePerUnit)
TransportationCost = (FuelCost/Litre * FuelUsedInLitre) + DriverCost

Ontology:

Profit owl:sameAs ProfitPerQuarter
NoOfUnits owl:sameAs NoOfItems

I have handled these independently before ie Used Prolog (SWI-Prolog) for handling production type of rules or Even a Drools to handle them on a different occasion. To query RDF/OWL, I have used Apache Jena. including writing rules on the Triple Store.

But, can you guys suggest a framework which can handle both, like in this situation. I have heard of Prova, which can handle these. But, can Jena or Drools have reasoner which can handle both.

I am also new to Apache Jena/ Reasoners etc. I have done similar arithmetic operations using Apache Jena reasoners. There are many built-in functions available in Jena inferencing model.

As you have not mentioned how the RDF triples look like I am assuming the following format.

:production :hasunits "100"^^xsd:int
:production :costperunit "20"^^xsd:int
:production :sellingprice "25"^^xsd:int

:production :fuelcostlitre "20"^^xsd:int
:production :fuelused "10"^^xsd:int
:production :drivercost "100"^^xsd:int

Rules for the above mentioned RDF looks like

 [r1: (?p :fuelcostlitre ?f) 
 (?p :fuelused ?l) (?p :drivercost ?d) product(?f ?l ?m)  sum(?m ?d ?s) 
  -> (?p :transportation ?s)]
 
 [r2: (?p :hasunits ?n) (?p :costperunit ?c) (?p :sellingprice ?m) 
 (?p :transportation ?t) product(?n ?c ?a)  product(?n ?m ?b) 
 sum(?a ?t ?e) difference(?e ?b ?d) 
 -> (?p :profit ?d)
 ]

More about Jena built-in you can refer here. https://jena.apache.org/documentation/inference/#RULEbuiltins

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM