In Thu, Jul 31, 2014 at 11:18 PM, Wang Darrell <[email protected]> wrote:
> Here is my data in tdb
>
>  - (yago:Majid_Majidi yago:hasGender yago:male)
>  - (yago:Majid_Majidi yago:actedIn yago:Boycott_film)
>  - (yago:Majid_Majidi yago:directed yago:Baran_film)
>  - (yago:Majid_Majidi yago:directed yago:The_Color_of_Paradise)
>  - (yago:Majid_Majidi yago:created yago:Children_of_Heaven)
>  - (yago:Majid_Majidi yago:created yago:Barefoot_to_Herat)
>
> and here is my rule
>
> [
> rule1:
> (?x http://yago-knowledge.org/resource/actedIn
> http://yago-knowledge.org/resource/Boycott_film)
> ->
> (?x http://yago-knowledge.org/resource/created
> http://yago-knowledge.org/resource/Boycott_film)
> ]
>
> If the rule works , I should get a new fact like
>
>  - (yago:Majid_Majidi yago:created yago:Boycott_film)
>
> but it won't works
> Is there some problem with my rules?

Without seeing your Java code, it's impossible to say.  Lots of things
could be wrong.  The prefix definitions could be wrong for instance.
You could be asking for the results incorrectly.  You might not be
running the rules on the data.  Lots of things could be wrong, and
without seeing your code, it is very hard to say.

> and there is second question
> Can I create a new fact that the resource  even not existing in my ontology
> like
>
> [
> rule1:
> (?x http://yago-knowledge.org/resource/actedIn
> http://yago-knowledge.org/resource/Boycott_film)
> ->
> (?x http://yago-knowledge.org/resource/is
> http://yago-knowledge.org/resource/director)
> ]
> the http://yago-knowledge.org/resource/is
> & http://yago-knowledge.org/resource/director
>
> is not in my ontology yet .
> Can I create this using the rules ?
> Or I should do something
> Resource director = model.createResource( prefix + "director" );

You can use the rule in the way that you have. As an aside, models
don't "contain resources", they contain *triples*, so code like

model.createResource( prefix + "director" );

doesn't actually make any change to the model, because it doesn't add
any new triples.

//JT
-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/

Reply via email to