Skip to search.
jena-dev · Jena Users

Group Information

  • Members: 2056
  • Category: Software
  • Founded: Sep 19, 2001
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Messages

  Messages Help
Advanced
Rules for validation   Message List  
Reply Message #17639 of 48259 |
Re: [jena-dev] Rules for validation

I found the problem.
 
the correct validationRule is this:       String validationRule = "[validationRule: (?v rb:validation on()) -> " +
  "[(?X rb:violation error('conflict', 'x86 with MacOs', ?X)) <- " +
  "(?X rdf:type laico:PersonalComputer) (?X laico:hasArchitecture ?Z) (?Z rdf:type laico:X86)" +
  "(?X laico:hasOS ?O) (?O rdf:type laico:MacOS)]]";
 
Because the hasArchitecture property has range in a class, not in a literal.
 
thanks all.
----- Original Message -----
Sent: Thursday, August 04, 2005 1:07 PM
Subject: Re: [jena-dev] Rules for validation

Hi, made the changes, but it still doesn´t work.
 
Any other idea?
 
I have also made the rule using no prefixes, http://laico.cic.unb.br/laico#PersonalComputer.
 
 
   public static void main(String[] args)
   {
      OntModel model = MomUtil.leOnto("ruleTest.owl");
 
      String validationRule = "[validationRule: (?v rb:validation on()) -> " +
            "[(?X rb:violation error('conflict', 'x86 with MacOs', ?X)) <- " +
            "(?X rdf:type laico:PersonalComputer) (?X laico:hasArchitecture 'X86')" +
            "(?X laico:hasOS ?O) (?O rdf:type laico:MacOS)]]";
 
      PrintUtil.registerPrefix("laico", "http://laico.cic.unb.br/laico#");
 
      List rules = Rule.parseRules(validationRule);
      System.out.println(rules);
      Reasoner reasoner = new GenericRuleReasoner(rules);
      InfModel inf = ModelFactory.createInfModel(reasoner, model);
      ValidityReport validityReport = inf.validate();
     
     
      if (!validityReport.isValid())
      {
         System.out.println("Error!!!!");
         Iterator iterator = validityReport.getReports();
         while (iterator.hasNext())
         {
            System.out.println(iterator.next());
         }
      }
   }
 
<?xml version="1.0"?>
   <rdf:RDF
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
      xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
      xmlns:owl="http://www.w3.org/2002/07/owl#"
      xmlns="http://laico.cic.unb.br/laico#"
      xml:base="http://laico.cic.unb.br/laico#">
  
   <owl:Ontology rdf:about=""/>
 
   <owl:Class rdf:ID="Windows">
      <rdfs:subClassOf>
         <owl:Class rdf:ID="OperatingSystem"/>
      </rdfs:subClassOf>
   </owl:Class>
 
   <owl:Class rdf:ID="Mac">
      <rdfs:subClassOf>
         <owl:Class rdf:ID="Architecture"/>
      </rdfs:subClassOf>
   </owl:Class>
 
   <owl:Class rdf:ID="MacOS">
      <rdfs:subClassOf>
      <owl:Class rdf:about="#OperatingSystem"/>
      </rdfs:subClassOf>
   </owl:Class>
 
   <owl:Class rdf:about="#Architecture">
      <rdfs:subClassOf>
         <owl:Class rdf:ID="Recurso"/>
      </rdfs:subClassOf>
   </owl:Class>
 
   <owl:Class rdf:ID="Unix">
      <rdfs:subClassOf>
         <owl:Class rdf:about="#OperatingSystem"/>
      </rdfs:subClassOf>
   </owl:Class>
 
   <owl:Class rdf:ID="Solaris">
      <rdfs:subClassOf>
         <owl:Class rdf:about="#OperatingSystem"/>
      </rdfs:subClassOf>
   </owl:Class>
 
   <owl:Class rdf:about="#OperatingSystem">
      <rdfs:subClassOf rdf:resource="#Recurso"/>
   </owl:Class>
 
   <owl:Class rdf:ID="PersonalComputer">
      <rdfs:subClassOf rdf:resource="#Recurso"/>
    </owl:Class>
 
   <owl:Class rdf:ID="X86">
      <rdfs:subClassOf rdf:resource="#Architecture"/>
   </owl:Class>
 
   <owl:ObjectProperty rdf:ID="hasArchitecture">
      <rdfs:range rdf:resource="#Architecture"/>
      <rdfs:domain rdf:resource="#PersonalComputer"/>
      <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/>
   </owl:ObjectProperty>
 
   <owl:TransitiveProperty rdf:ID="hasOS">
      <rdfs:domain rdf:resource="#PersonalComputer"/>
      <rdfs:range rdf:resource="#OperatingSystem"/>
      <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
   </owl:TransitiveProperty>
 
   <MacOS rdf:ID="MacOS_15"/>
   <X86 rdf:ID="X86_14"/>
   <PersonalComputer rdf:ID="PersonalComputer_13">
      <hasOS rdf:resource="#MacOS_15"/>
      <hasArchitecture rdf:resource="#X86_14"/>
   </PersonalComputer>
</rdf:RDF>
<!--
Created with Protege (with OWL Plugin 2.1, Build 284) http://protege.stanford.edu -->
 
----- Original Message -----
From: "Dave Reynolds" <der@...>
Sent: Thursday, August 04, 2005 12:01 PM
Subject: Re: [jena-dev] Rules for validation

José Geraldo Campos wrote:

> Hi Dave, I think I´ve done the rigth thing, but it seems that it didn´t
> work.
> here is the code and the owl i used:

This may not be the only problem but:

>       String validationRule = "[validationRule: (?v rb:validation on())
> -> " +
>         "[rule1: (?X rb:violation error('x86 with MacOs')) <- " +
>         "(?X rdf:type eg:PersonalComputer) (?X eg:hasArchitecture 'X86')" +
>         "(?X eg:hasOS ?O) (?O rdf:type eg:MacOS)]]";

You need to match up the "eg:" prefix to the namespace you are using in
your ontology. Either put your rules in a file and use @prefix to declare
it or make an explicit call to PrintUtil to register a prefix for your
namespace and use that in the rules.

Dave


Thu Aug 4, 2005 4:16 pm

jgeralldo
Offline Offline
Send Email Send Email

Message #17639 of 48259 |
Expand Messages Author Sort by Date

How can I add a rule for show some inconsistence in ontology files? I want, for example, that if I have the classes: - PersonalComputer and - OperationalSystem...
José Geraldo Campos
jgeralldo Offline Send Email
Aug 2, 2005
7:02 pm

... Something like this could be probably be expressed in pure OWL (though it would require oneOfs which aren't very well supported in the current rules being...
Dave Reynolds
derihy Offline Send Email
Aug 3, 2005
8:25 am

Hi Dave, I think I´ve done the rigth thing, but it seems that it didn´t work. here is the code and the owl i used: public static void main(String[] args) { ...
José Geraldo Campos
jgeralldo Offline Send Email
Aug 4, 2005
2:35 pm

... You need to match up the "eg:" prefix to the namespace you are using in your ontology. Either put your rules in a file and use @prefix to declare it or...
Dave Reynolds
derihy Offline Send Email
Aug 4, 2005
3:01 pm

Hi, made the changes, but it still doesn´t work. Any other idea? I have also made the rule using no prefixes, http://laico.cic.unb.br/laico#PersonalComputer. ...
José Geraldo Campos
jgeralldo Offline Send Email
Aug 4, 2005
4:05 pm

I found the problem. the correct validationRule is this: String validationRule = "[validationRule: (?v rb:validation on()) -> " + "[(?X rb:violation...
José Geraldo Campos
jgeralldo Offline Send Email
Aug 4, 2005
4:13 pm
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help