0

In the following code, the ValidityReport is always valid; there is no inconsistency detected. I expect that it should give me a warning because I am giving a family name to a FOAF document. Why isn't an inconsistency detected?

    Model model = ModelFactory.createDefaultModel();
    OntModel m = ModelFactory.createOntologyModel();
    m.read(FOAF.NS);
    Resource persona = model.createResource("http://www.example.org/rdf#Persona", FOAF.Document);
    persona.addProperty(FOAF.family_name, "18", XSDDatatype.XSDint);
    InfModel infModel = ModelFactory.createRDFSModel(m, model);
    ValidityReport validity = infModel.validate();
    if (validity.isValid()) {
      System.out.println("Valid!");
    } else {
      System.out.println("Conflicts");
      for (Iterator<Report> in = validity.getReports(); in.hasNext();) {
        System.out.println(" - " + in.next());
      }
    }
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
Ariel
  • 1,222
  • 2
  • 14
  • 25
  • What's the matter with giving a familyName to a FOAF document? – Joshua Taylor Feb 25 '14 at 23:22
  • That previous comment is a little bit tongue-in-cheek; it might be counter intuitive for a FOAF document to have a family name, but do you have some particular reason to expect that it should be logically inconsistent? – Joshua Taylor Feb 25 '14 at 23:39

1 Answers1

2

The instance data that you're creating is this:

@prefix ex:    <http://www.example.org/rdf#> .
@prefix foaf:  <http://xmlns.com/foaf/0.1/> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .

ex:Persona  a             foaf:Document ;
        foaf:family_name  "18"^^xsd:int .

There's a resource of type foaf:Document, and it has an xsd:int value for the the foaf:family_name property.

Your inference model uses an RDFS reasoner. The domain of foaf:family_name (which, by the way, is described as an archaic spelling of foaf:familyName) is foaf:Person, so ex:Persona can thus be inferred to be a foaf:Person, as we see if we write the inference model. There are a number of other types that ex:Persona is inferred to have as well:

ex:Persona  a             foaf:Document , foaf:Person , <http://www.w3.org/2000/01/rdf-schema#Resource> , <http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing> , foaf:Agent ;
        foaf:family_name  "18"^^xsd:int .

It's rather hard to have inconsistencies in an RDFS model, since you can't really say a whole lot. You can't declare disjoint classes, for instance, so there's no contradiction between something being a foaf:Document and a foaf:Person.

Even if you use an OWL reasoner, you'd still need to pinpoint some particular logical inconsistency. I don't know whether any of those types that ex:Persona has are disjoint, and if they're not (or if the reasoner can't infer that they are), you're not going to find an inconsistency.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • Regarding the 'foaf:family_name' it's because I used the FOAF Jena class. Should I input by hand the 'foaf:familyName' property? – Ariel Feb 26 '14 at 09:41
  • It's not really that important; it's just an artifact of the FOAF class in Jena being generated from an older version of the FOAF vocabulary. The only reason I noticed at all was that I was looking at the current version of the vocabulary to see if there were any obvious axioms that would lead to an inconsistency here. – Joshua Taylor Feb 26 '14 at 14:53