Package com.hp.hpl.jena.ontology

Examples of com.hp.hpl.jena.ontology.OntModel.createTypedLiteral()


      p.addRange( datatype );

      int start = i;
      while( i < datatypes.length && datatypes[i] instanceof String ) {
        Individual ind = model.createIndividual( ns + "testInd" + i, OWL.Thing );
        Literal value = model.createTypedLiteral( (String) datatypes[i], datatype.getURI() );
        ind.addProperty( p, value );

        OntClass c = model.createClass( ns + "testCls" + i );
        c.addEquivalentClass( model.createHasValueRestriction( null, p, value ) );
View Full Code Here


    DatatypeProperty dp = model.createDatatypeProperty( ns + "dp" );
    dp.convertToInverseFunctionalProperty();

    a.addProperty( op, c );

    Literal one = model.createTypedLiteral( Integer.valueOf( 1 ) );
    a.addProperty( dp, one );
    b.addProperty( dp, one );

    model.prepare();
View Full Code Here

    Individual a = model.createIndividual( ns + "a", C );
    Individual b = model.createIndividual( ns + "b", C );
    Individual c = model.createIndividual( ns + "c", C );

    Literal zero = model.createTypedLiteral( Integer.valueOf( 0 ) );
    a.addProperty( dp, zero );

    b.addRDFType( model.createAllValuesFromRestriction( null, dp, XSD.nonPositiveInteger ) );

    Literal one = model.createTypedLiteral( Integer.valueOf( 1 ) );
View Full Code Here

    Literal zero = model.createTypedLiteral( Integer.valueOf( 0 ) );
    a.addProperty( dp, zero );

    b.addRDFType( model.createAllValuesFromRestriction( null, dp, XSD.nonPositiveInteger ) );

    Literal one = model.createTypedLiteral( Integer.valueOf( 1 ) );
    c.addProperty( dp, one );

    model.prepare();

    assertTrue( a.isSameAs( b ) );
View Full Code Here

    DatatypeProperty dp = model.createDatatypeProperty( ns + "dp" );

    OntClass C = model.createClass( ns + "C" );
    Individual a = model.createIndividual( ns + "a", C );

    Literal one = model.createTypedLiteral( "1", TypeMapper.getInstance().getTypeByName(
        XSD.positiveInteger.getURI() ) );
    a.addProperty( dp, one );

    model.prepare();
View Full Code Here

        XSD.positiveInteger.getURI() ) );
    a.addProperty( dp, one );

    model.prepare();

    Literal oneDecimal = model.createTypedLiteral( "1", TypeMapper.getInstance().getTypeByName(
        XSD.decimal.getURI() ) );
   
    assertIteratorValues( a.listPropertyValues( dp ), new Literal[] { one } );
    assertTrue( a.hasProperty( dp, oneDecimal ) );
  }
View Full Code Here

    assertTrue( model.contains( ind1, p, ind1 ) );
    assertTrue( model.contains( ind1, RDF.type, test2 ) );
    assertTrue( model.contains( ind1, RDF.type, test3 ) );
    assertTrue( model.contains( ind7, OWL.differentFrom, ind8 ) );
    assertTrue( model.contains( ind8, OWL.differentFrom, ind7 ) );
    assertTrue( model.contains( ind1, dp, model.createTypedLiteral( false ) ) );
    assertIteratorValues( ind1.listRDFTypes( false ),
        new Object[] { OWL.Thing, C, test2, test3 } );

    assertTrue( model.contains( Teenager, RDFS.subClassOf, OlderThan10 ) );
    assertTrue( model.contains( Teenager, RDFS.subClassOf, YoungerThan20 ) );
View Full Code Here

    Resource b = model.createResource( ns + "b" );

    Property feet = model.createProperty( ns + "lengthInFeet" );
    Property inches = model.createProperty( ns + "lengthInInches" );

    RDFNode lit12 = model.createTypedLiteral( 12.0f );
    RDFNode lit24 = model.createTypedLiteral( 24.0f );

    Model inferences = ModelFactory.createDefaultModel();
    PelletTestCase.addStatements( inferences, a, feet, model.createTypedLiteral( 1f ) );
    PelletTestCase.addStatements( inferences, b, feet, model.createTypedLiteral( 2f ) );       
View Full Code Here

    Property feet = model.createProperty( ns + "lengthInFeet" );
    Property inches = model.createProperty( ns + "lengthInInches" );

    RDFNode lit12 = model.createTypedLiteral( 12.0f );
    RDFNode lit24 = model.createTypedLiteral( 24.0f );

    Model inferences = ModelFactory.createDefaultModel();
    PelletTestCase.addStatements( inferences, a, feet, model.createTypedLiteral( 1f ) );
    PelletTestCase.addStatements( inferences, b, feet, model.createTypedLiteral( 2f ) );       
    PelletTestCase.assertPropertyValues( model, feet, inferences );
View Full Code Here

    RDFNode lit12 = model.createTypedLiteral( 12.0f );
    RDFNode lit24 = model.createTypedLiteral( 24.0f );

    Model inferences = ModelFactory.createDefaultModel();
    PelletTestCase.addStatements( inferences, a, feet, model.createTypedLiteral( 1f ) );
    PelletTestCase.addStatements( inferences, b, feet, model.createTypedLiteral( 2f ) );       
    PelletTestCase.assertPropertyValues( model, feet, inferences );
   
    inferences = ModelFactory.createDefaultModel();
    PelletTestCase.addStatements( inferences, a, inches, lit12 );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.