On 01/08/13 05:39, Kang, Sungku wrote: > To whom it may concern, > > My name is SungKu, who's working as a graduate research assistant at UIUC and > working on Jena and SADL(which is based on Jena). > > I'd like to perform reasoning based on the number of object related with a > subject through certain kind of property. > (e.g. Polygon and (hasSide exactly 4 Thing) is a Square) > > I know counting requires closed world assumption but I want to know if there > are some built-in primitive which can perform as if the ontology is based on > closed world assumption. > (e.g. "hasNumberOfPropertyValues" of SWRL built-in) > > Is there any Jena rule built-in primitives or other feature that can perform > such reasoning?
You can count the number of values, or properties with values, that are materialized in the RDF by simply listing them and counting how many you have. This can be done through appropriate listStatements calls or through SPARQL which supports a COUNT aggregator. Beware that such things are simply counting the values they see and so may not interact nicely with other reasoning capability. For example, if you have something declared as a Square then you "know" it has four sides but those sides may not be declared in the data. There is no builtin rule engine primitive for such counting but you can define your own and register it. Dave
