Package com.hp.hpl.jena.ontology

Examples of com.hp.hpl.jena.ontology.Individual


      //list instances
      for (Iterator i=cls.listInstances(); i.hasNext(); ) {
        //add search terms for each instance

        //list labels
        Individual individual = (Individual) i.next();
        for (Iterator j=individual.listLabels(null); j.hasNext();) {
          Literal l = (Literal) j.next();
          OntologyImpl.addSearchTerm(l.toString(), individual);
        }
      }
    }
View Full Code Here


      }
   
      if (resource instanceof Individual) {
      //get all individuals same as this one
        for (Iterator i=resource.listSameAs(); i.hasNext();) {
          Individual individual = (Individual) i.next();
          //add labels
          for (Iterator j =individual.listLabels(null); j.hasNext();) {
            Literal l = (Literal) i.next();
            synonyms.put(l.toString(), "1");
          }
        }
      } else if (resource instanceof OntClass) {
View Full Code Here

        occurs.add( cls );
        renderHierarchy( out, sub, occurs, depth + 1 );
        occurs.remove( cls );
      }
      for (Iterator i=cls.listInstances(); i.hasNext(); ) {
        Individual individual = (Individual) i.next();
        renderURI(out, individual.getModel(), individual.getURI());
        out.print(" [");
        for (Iterator j=individual.listLabels(null); j.hasNext();) {
          out.print(((Literal)j.next()).getString()+", ");
        }
        out.print("] ");
        out.println();
      }
View Full Code Here

        base.read( sourceURL, "RDF/XML" );

        OntModel inf = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM_MICRO_RULE_INF, base );

        OntClass paperClass = base.getOntClass( namespace + "Paper" );
        Individual paper = base.createIndividual( namespace + "paper1", paperClass );

        System.out.println("---- Assertions in the data ----");
        for (Iterator<Resource> i = paper.listRDFTypes(false); i.hasNext(); ) {
            System.out.println( paper.getURI() + " is a " + i.next() );
        }

        System.out.println("\n---- Inferred assertions ----");
        paper = inf.getIndividual( namespace + "paper1" );
        for (Iterator<Resource> i = paper.listRDFTypes(false); i.hasNext(); ) {
            System.out.println( paper.getURI() + " is a " + i.next() );
        }
    }
View Full Code Here

    ObjectProperty sibling = model.getObjectProperty( ont + "#sibling" );

    OntClass BadChild = model.getOntClass( ont + "#BadChild" );
    OntClass Child = model.getOntClass( ont + "#Child" );

    Individual Abel = model.getIndividual( ont + "#Abel" );
    Individual Cain = model.getIndividual( ont + "#Cain" );
    Individual Remus = model.getIndividual( ont + "#Remus" );
    Individual Romulus = model.getIndividual( ont + "#Romulus" );

    model.prepare();

    // Cain has sibling Abel due to SiblingRule
    printPropertyValues( Cain, sibling );
View Full Code Here

    Property foafName = model.getProperty("http://xmlns.com/foaf/0.1/name");
   
    // get all instances of Person class
    Iterator<?> i = Person.listInstances();
    while( i.hasNext() ) {
        Individual ind = (Individual) i.next();
       
        // get the info about this specific individual
        String name = ((Literal) ind.getPropertyValue( foafName )).getString();
        Resource type = ind.getRDFType();
        Resource homepage = (Resource) ind.getPropertyValue(workHomepage);
       
        // print the results
        System.out.println("Name: " + name);
        System.out.println("Type: " + type.getLocalName());
        if(homepage == null)
View Full Code Here

    long e = System.currentTimeMillis();
    System.out.println( "Consistent? " + consistent + " (" + (e - s) + "ms)" );

    // perform ABox addition which results in a consistent KB
    Resource concept = model.getResource( mindswap + "GraduateStudent" );
    Individual individual = model.createIndividual( mindswappers + "JohnDoe", concept );

    // perform incremental consistency check
    s = System.currentTimeMillis();
    consistent = pelletJenaGraph.isConsistent();
    e = System.currentTimeMillis();
    System.out.println( "Consistent? " + consistent + " (" + (e - s) + "ms)" );

    // perform ABox addition which results in an inconsistent KB
    Property role = model.getProperty( foaf + "mbox" );
    individual = model.getIndividual( mindswappers + "Christian.Halaschek" );
    RDFNode mbox = model.getIndividual( "mailto:kolovski@cs.umd.edu" );
    individual.addProperty( role, mbox );

    // perform incremental consistency check
    s = System.currentTimeMillis();
    consistent = pelletJenaGraph.isConsistent();
    e = System.currentTimeMillis();
View Full Code Here

    System.out.println( "Total time " + (e - s) + " ms)" );
    JenaReasoner.printIterator( model.validate().getReports(), "Validation Results" );

    // perform ABox addition which results in a consistent KB
    Resource concept = model.getResource( mindswap + "GraduateStudent" );
    Individual individual = model.createIndividual( mindswappers + "JohnDoe", concept );

    // perform incremental consistency check
    s = System.currentTimeMillis();
    model.prepare();
    e = System.currentTimeMillis();

    //print time and validation report
    System.out.println( "Total time " + (e - s) + " ms)" );
    JenaReasoner.printIterator( model.validate().getReports(), "Validation Results" );

    // perform ABox addition which results in an inconsistent KB
    Property role = model.getProperty( foaf + "mbox" );
    individual = model.getIndividual( mindswappers + "Christian.Halaschek" );
    RDFNode mbox = model.getIndividual( "mailto:kolovski@cs.umd.edu" );
    individual.addProperty( role, mbox );

    // perform incremental consistency check
    s = System.currentTimeMillis();
    model.prepare();
    e = System.currentTimeMillis();
View Full Code Here

    ObjectProperty p = model.createObjectProperty( "p" );
    ObjectProperty t = model.createObjectProperty( "t" );
    DatatypeProperty q = model.createDatatypeProperty( "q" );
    AnnotationProperty r = model.createAnnotationProperty( "r" );

    Individual a = model.createIndividual( "a", OWL.Thing );
    Individual b = model.createIndividual( "b", OWL.Thing );

    model.add( t, RDF.type, OWL.TransitiveProperty );

    model.prepare();
View Full Code Here

    ObjectProperty p3 = ont.createObjectProperty( ns + "p3" );

    p2.addSubProperty( p1 );
    p2.addInverseOf( p3 );

    Individual s1 = ont.createIndividual( ns + "s1", OWL.Thing );
    Individual o1 = ont.createIndividual( ns + "o1", OWL.Thing );
    Individual s2 = ont.createIndividual( ns + "s2", OWL.Thing );
    Individual o2 = ont.createIndividual( ns + "o2", OWL.Thing );
    Individual s3 = ont.createIndividual( ns + "s3", OWL.Thing );
    Individual o3 = ont.createIndividual( ns + "o3", OWL.Thing );

    s1.addProperty( p1, o1 );
    s2.addProperty( p2, o2 );
    s3.addProperty( p3, o3 );
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.ontology.Individual

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.