2

Animal_Lover class is a class that has three properties called hasPet.

Smith raises three animals and belongs to Person class.

At this point, how do I write rule(.pie) to automatically include smith in the animal_lover class when the rule works?

Prefices {
    test : http://www.example.com/test#
    rdf : http://www.w3.org/1999/02/22-rdf-syntax-ns#
    owl : http://www.w3.org/2002/07/owl#
    xsd : http://www.w3.org/2001/XMLSchema#
    rdfs : http://www.w3.org/2000/01/rdf-schema#
}
Axioms {}

Rules {
    Id: rule1
        a <test:hasPet> b
        a <test:hasPet> d
        a <test:hasPet> c           
        -----------------------
        a <rdf:type> <test:Animal_Lover>
}

this rule does not work.

HoJin Seo
  • 43
  • 2
  • and you did add the rule file properly? – UninformedUser Sep 08 '18 at 17:03
  • and what means does not work? and shouldn't you add constraints that `b != d`and `b != c` and `c != d` ? – UninformedUser Sep 08 '18 at 17:05
  • @AKSW Yes. I added a rule file, added constraints, but it did not work. And 'not work' means the rule did not fire. I also tried the following command. `INSERT DATA { [] [] }` – HoJin Seo Sep 09 '18 at 12:25
  • 4
    Works for me as expected, I uploaded the custom ruleset `Prefices { test : http://www.example.com/test# rdf : http://www.w3.org/1999/02/22-rdf-syntax-ns# owl : http://www.w3.org/2002/07/owl# xsd : http://www.w3.org/2001/XMLSchema# rdfs : http://www.w3.org/2000/01/rdf-schema# } Axioms {} Rules { Id: rule1 a b [Constraint b != d, b != c] a d [Constraint d != b, d != c] a c [Constraint c != b, c != d] ----------------------- a }` – UninformedUser Sep 09 '18 at 15:02
  • 2
    created a repository with the custom ruleset , inserted some data `prefix test: insert data { test:a test:hasPet test:b1,test:b2, test:b3 . }` and finally did a simple `select * where { ?s ?p ?o . } limit 100 ` returns `test:a rdf:type test:Animal_Lover` – UninformedUser Sep 09 '18 at 15:03

1 Answers1

0

Did you look in the log for any errors? This line seems suspect to me, I think the brackets should be on different lines

Axioms {}

Vladimir Alexiev
  • 2,477
  • 1
  • 20
  • 31