See, for example, here: "RDFS/OWL are not constraint or validation languages" http://answers.semanticweb.com/questions/1837/common-semantic-web-misconceptions-youve-encountered
You might be interested in http://openjena.org/Eyeball/ which, according to the documentation, can check for "unknown [with respect to the schemas] properties and classes". Paolo Maatary Daniel OKOUYA wrote: > I have the following RDF schema files: > > <!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]> > <rdf:RDF > xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > xml:base="http://www.people.lu.unisi.ch/fornaran/schemas/ocean-rdf0"> > > <rdfs:Class rdf:ID="Event"> > <rdfs:subClassOf > rdf:resource="http://www.w3c.org/TR/1999/PR-rdf-schema-19990303#Resource"/> > </rdfs:Class> > > <rdfs:Class rdf:ID="TimeEvent"> > <rdfs:subClassOf rdf:resource="#Event"/> > </rdfs:Class> > > <rdf:Property rdf:ID="atTime"> > <rdfs:domain rdf:resource="#Event"/> > </rdf:Property> > > <rdfs:Class rdf:ID="Action"> > <rdfs:subClassOf rdf:resource="#Event"/> > <rdfs:comment>This describes the set of actions</rdfs:comment> > </rdfs:Class> > > <rdfs:Class rdf:ID="Agent"> > <rdfs:subClassOf > rdf:resource="http://www.w3c.org/TR/1999/PR-rdf-schema-19990303#Resource"/> > </rdfs:Class> > > <rdf:Property rdf:ID="hasActor"> > <rdfs:domain rdf:resource="#Action"/> > <rdfs:range rdf:resource="#Agent"/> > </rdf:Property> > > <rdf:Property rdf:ID="hasDeadline"> > <rdfs:domain rdf:resource="#Action"/> > </rdf:Property> > > <rdf:Property rdf:ID="hasDuration"> > <rdfs:domain rdf:resource="#Action"/> > </rdf:Property> > > </rdf:RDF> > > > > > > <!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]> > <rdf:RDF > xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > xmlns:ocean="http://www.people.lu.unisi.ch/fornaran/schemas/ocean-rdf0#" > xml:base="http://www.people.lu.unisi.ch/fornaran/schemas/app"> > > <rdfs:Class rdf:ID="Pay"> > <rdfs:subClassOf rdf:resource="ocean:Action"/> > </rdfs:Class> > > <rdf:Property rdf:ID="hasAmount"> > <rdfs:domain rdf:resource="ocean:Pay"/> > </rdf:Property> > > <rdfs:Class rdf:ID="Deliver"> > <rdfs:subClassOf rdf:resource="ocean:Action"/> > </rdfs:Class> > > <rdf:Property rdf:ID="hasRecipient"> > <rdfs:domain rdf:resource="ocean:Deliver"/> > <rdfs:domain rdf:resource="ocean:Pay"/> > </rdf:Property> > > <rdf:Property rdf:ID="hasObject"> > <rdfs:domain rdf:resource="ocean:Deliver"/> > </rdf:Property> > > </rdf:RDF> > > > > > the following instance file where i have included the misstake > <app:hasAmounty>5</app:hasAmounty> hasAmounty is defined nowhere: > > <!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]> > <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > > xmlns:ocean="http://www.people.lu.unisi.ch/fornaran/schemas/ocean-rdf0#" > > xmlns:app="http://www.people.lu.unisi.ch/fornaran/schemas/app-rdf0#" > > xml:base="http://www.people.lu.unisi.ch/fornaran/example/promise"> > > <app:Pay rdf:ID="JohnAction1"> > <ocean:hasActor>John</ocean:hasActor> > <ocean:hasDuration>2</ocean:hasDuration> > <app:hasRecipient>Mary</app:hasRecipient> > <app:hasAmount>5</app:hasAmount> > <app:hasAmounty>5</app:hasAmounty> > </app:Pay> > > <app:Deliver rdf:ID="MaryAction1"> > <ocean:hasActor>Mary</ocean:hasActor> > <app:hasRecipient>John</app:hasRecipient> > <app:hasObject rdf:resource="#book1"></app:hasObject> > </app:Deliver> > > <app:book rdf:ID="book1"></app:book> > > </rdf:RDF> > > > I don't understand why the validation do not raise an error. > > here is my code > > / create an empty model > Model modelschema = > FileManager.get().loadModel(modelschemafilename); > Model modelschema2 = > FileManager.get().loadModel(modelschemafilename2); > modelschema.add(modelschema2); > Model model = FileManager.get().loadModel(modelfilename); > > > InfModel inf = ModelFactory.createRDFSModel(modelschema, model); > ValidityReport vrpt = inf.validate(); > > > System.out.println("is valid: " + vrpt.isValid()); > System.out.println("is clean: " + vrpt.isClean()); > Iterator<Report> itrpt = vrpt.getReports(); > > while(itrpt.hasNext()) { > Report rpt = itrpt.next(); > rpt.toString(); > } > > > And the answer is always: > > > is valid: true > is clean: true > > > Can anyone give a hand here ? > >
