Hi Luis,

On 16/03/2020 09:41, Luis Enrique Ramos García wrote:
Hi again Dave,

sorry if I have not explained appropriately,

let me tell you at first my goal: I am inspecting a dataset of 1,5 millions
individuals, againts another dataset with 5k *search_ID *values, where I
have  to get an individual with a given value in a property. I use rule 2
with search_ID in *registration_Authority_entity_ID* property, in order to
identify individuals with search_ID value. I think rule 2 could be
rewritten as follows:

rule 2=  (?b rdf_ns:type   Entity)  (?b registration_Authority_entity_ID "
*search_ID'*) -> (?b has_ord ?ord)

  rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns";
  rdf_ns = rdf+"#"

Unclear why you are using rules for rather than simply a Sparql query.

That example is *still* not a legal rule syntax.

In my experience with owl api, when a rule is triggered, no change occurred
in the original data, that means rule does not affect original model, and
an inferred model is generated, and this model can be store separated.

Um, this is Jena not the OWL API. It is true that if a forward rule fires the result of the rule will be asserted in the deductions model.

When
I trigger rule 2, I obtained this inferred model, and when I inspect it, I
can see the individual with the property value, but wrong,

Not sure what you mean by "wrong". It's doing what it is supposed to do. You haven't bound ?ord so it can't assert a value for it in the deductions model.

in the same way,
when I execute rule 1, I do not obtain any result, and model holds blank. I
code the necessary control element to verify that inferred model of rule 1
holds blank, in other words I confirm that there is not triggering.

I repeat, if you can't get your rule 1 to fire and you still need help then show us actual minimal test data (need only be a few statements, sufficient to match the rule) and actual rule syntax not isolated fragments of your source code with key values missing. The chances are you have a namespace/URI error somewhere.

Dave

Currently I am executing the following rule:

rule_3 = (?b rdf_ns:type Entity)  (?b registration_Authority_entity_ID
*search_ID*) -> (?b rdf_ns:type Entity)

So, I obtain all ?b individuals with value search_ID, however I require
extra work to obtain the target property value, that will let me identify
my individual later, and I think I should be able to get it with the rule.


Hope this could clarify a little more my use case.


Luis Ramos











El lun., 16 mar. 2020 a las 10:04, Dave Reynolds (<dave.e.reyno...@gmail.com>)
escribió:


On 16/03/2020 08:49, Luis Enrique Ramos García wrote:
Hi Dave,

thanks for your quick response,

I though that was the cause of the problem, however when I add the bind
to
?ord in the body, then the rule is not triggered , I changed  as in rule
1:


String rule 1=  (?b rdf_ns:type  GLEIF1_NS Entity)  (?b GLEIF1_NS has_ord
?ord) (?b GLEIF1_NS registration_Authority_entity_ID "search_ID') -> (?b
GLEIF1_NS has_ord ?ord)

What's that supposed to do? You seem to be binding ?ord then asserting
the same value back again. So that will have no effect on the data.

String rule 2=  (?b rdf_ns:type  GLEIF1_NS Entity)  (?b GLEIF1_NS
registration_Authority_entity_ID "search_ID') -> (?b GLEIF1_NS has_ord
?ord)

What's that supposed to do? There's no binding for ?ord so why would you
expect it to have a specific value?

as shown above the rule 1 does not trigger, rule 2 does trigger as
expected, but the output value does not corresponds to the value of
?ord. I
obtained this value > *ae791d81-7538-49ac-9436-898ede09d7b5*], and should
have been >
ord:urn:iso:std:iso:17442:2019:ed-1:v2:en:[097900BHID0000080614]

Sorry I can't follow what you are attempting to do. Tou aren't showing
us the actual data (with namespaces) or actual rules (with all these
variables expanded) so it's hard to spot the details. Also unclear what
you mean by "output", whether you are looking at a dump of the whole
model, just the deductions graph or something else.

How you do you know the first rule isn't firing? Since it makes no
change to the data it's going to be hard to tell. Use the print builtin
to help debug.

If you can't work it out then generate a minimal complete test case with
just minimal test data (ideally in turtle with all prefixes defined) and
minimal rule example (actual rule, not source code snippet that
generates the rule) then post that. Then maybe someone can spot what's
happening.

Dave

El lun., 16 mar. 2020 a las 9:13, Dave Reynolds (<
dave.e.reyno...@gmail.com>)
escribió:


On 16/03/2020 06:58, Luis Enrique Ramos García wrote:
Dear friends,

I am running a rule in a data set, which has the following format:

     <j.0:Entity rdf:about="
http://www.example.com/onto/gleif1.owl#097900BHID0000080614";>
       <rdfs:label


xml:lang="ia">ord:urn:iso:std:iso:17442:2019:ed-1:v2:en:[097900BHID0000080614]</rdfs:label>
       <rdfs:label xml:lang="en">scope s.r.o.</rdfs:label>



<j.0:registration_Authority_entity_ID>search_ID</j.0:registration_Authority_entity_ID>

<j.0:registration_Authority_ID>RA000526</j.0:registration_Authority_ID>
       <j.0:legal_Name>scope s.r.o.</j.0:legal_Name>
*


<j.0:has_ord>ord:urn:iso:std:iso:17442:2019:ed-1:v2:en:[097900BHID0000080614]</j.0:has_ord>*
       <owl:versionInfo>1</owl:versionInfo>


where I want to obtain the *has_ord* property value with the rule:

    String rule_rid= "[rule1: (?b "+rdf_ns+"type "+GLEIF1_NS+"Entity) "
+ "(?b "+GLEIF1_NS+"registration_Authority_entity_ID
"+"'"+search_ID+"')"//get all gleif entities ID
+ "-> (?b "+GLEIF1_NS+"has_ord ?ord)]";//put the output

That's very hard to read but unless I'm missing something there's
nothing in the body of the rule to bind ?ord.

Dave


The rule is triggered as expected, however the value in the output does
not
corresponds to the real value:

output:

http://www.example.com/onto/gleif1.owl#has_ord,
*ae791d81-7538-49ac-9436-898ede09d7b5*]

but, it should be:

http://www.example.com/onto/gleif1.owl#has_ord,*
ord:urn:iso:std:iso:17442:2019:ed-1:v2:en:[097900BHID0000080614]
]*


I am running the jena rule against a model stored in a tdb database.

Thanks in advanced for your support.


Luis Ramos





Reply via email to