Package com.hp.hpl.jena.ontology

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


    OntClass C = model.createClass( ns + "C" );
    Individual anon1 = model.createIndividual( 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


    c8.addEquivalentClass( model.createSomeValuesFromRestriction( null, s, model.createIntersectionClass( null, model.createList( l8 ) ) ) );
    assertFalse( model.contains(c8, RDFS.subClassOf, OWL2.Nothing ) );
   
    OntClass c9 = model.createClass( ns + "c9" );
    Resource fr9 = model.createResource();
    model.add( fr9, OWL2.maxExclusive, model.createTypedLiteral( 0 ) );
    Resource b9 = model.createResource();
    model.add( b9, RDF.type, RDFS.Datatype);
    model.add( b9, OWL2.onDatatype, i);
    model.add( b9, OWL2.withRestrictions, model.createList( new RDFNode[] { fr9 } ));
    RDFNode[] l9 = new RDFNode[2];
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 datatype = (Resource) datatypes[i++];
      OntProperty p = model.createDatatypeProperty( ns + "prop_" + datatype.getLocalName() );
      p.addRange( datatype );

      while( i < datatypes.length && datatypes[i] instanceof String ) {
        Literal value = model.createTypedLiteral( (String) datatypes[i], datatype.getURI() );
        ind.addProperty( p, value );
        i++;
      }
    }
View Full Code Here

              + datatype.getLocalName() );
          if( addRangeRestriction ) {
                      p.addRange( datatype );
                    }

          Literal value = model.createTypedLiteral( (String) datatypes[i], datatype
              .getURI() );
          ind.addProperty( p, value );

          assertFalse( value.getLexicalForm() + " should not belong to "
              + datatype.getLocalName(), model.validate().isValid() );
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.