Package com.hp.hpl.jena.rdf.model

Examples of com.hp.hpl.jena.rdf.model.Property


  public void testValidity()
  {

    final Resource root = model.createResource(TestList.NS + "root");
    final Property p = model.createProperty(TestList.NS, "p");

    // a list of the nil object, but not typed
    final Resource nil = RDF.nil;
    model.add(root, p, nil);
    final RDFList l0 = getListRoot(model);
View Full Code Here


  public void testCreateStatementTypeLiteral()
  {
    final Model model = ModelFactory.createDefaultModel();
    final Resource R = model.createResource("http://example/r");
    final Property P = model.createProperty("http://example/p");
    model.add(R, P, "2", XSDDatatype.XSDinteger);
    final Literal L = ResourceFactory.createTypedLiteral("2",
        XSDDatatype.XSDinteger);
    Assert.assertTrue(model.contains(R, P, L));
    Assert.assertFalse(model.contains(R, P, "2"));
View Full Code Here

    }
  }

  public void testCreatePropertyOneArg()
  {
    final Property p = model.createProperty("abc/def");
    Assert.assertEquals("abc/", p.getNameSpace());
    Assert.assertEquals("def", p.getLocalName());
    Assert.assertEquals("abc/def", p.getURI());
  }
View Full Code Here

  }

  public void testCreatePropertyStrangeURI()
  {
    final String uri = RDF.getURI() + "_345";
    final Property p = model.createProperty(uri);
    Assert.assertEquals(RDF.getURI(), p.getNameSpace());
    Assert.assertEquals("_345", p.getLocalName());
    Assert.assertEquals(uri, p.getURI());
  }
View Full Code Here

  }

  public void testCreatePropertyStrangeURITwoArgs()
  {
    final String local = "_345";
    final Property p = model.createProperty(RDF.getURI(), local);
    Assert.assertEquals(RDF.getURI(), p.getNameSpace());
    Assert.assertEquals(local, p.getLocalName());
    Assert.assertEquals(RDF.getURI() + local, p.getURI());
  }
View Full Code Here

    Assert.assertEquals(RDF.getURI() + local, p.getURI());
  }

  public void testCreatePropertyTwoArgs()
  {
    final Property p = model.createProperty("abc/", "def");
    Assert.assertEquals("abc/", p.getNameSpace());
    Assert.assertEquals("def", p.getLocalName());
    Assert.assertEquals("abc/def", p.getURI());
  }
View Full Code Here

    Assert.assertTrue(r.addProperty(RDF.value, tvResource).hasProperty(
        RDF.value, tvResource));
    Assert.assertTrue(r.getRequiredProperty(RDF.value).getSubject()
        .equals(r));
    //
    final Property p = model.createProperty("foo/", "bar");
    try
    {
      r.getRequiredProperty(p);
      Assert.fail("should detect missing property");
    }
View Full Code Here

      // System.out.println("Test " + count);
      final Model incoming = createModel();
      incoming.read(new StringReader(src), null, "N3");

      // Find the bNode that will be rewritten
      final Property name = incoming.createProperty(
          "http://xmlns.com/foaf/0.1/", "name");
      final ResIterator ri = incoming.listSubjectsWithProperty(name,
          "Ian Dickinson");
      final Resource bNode = ri.nextResource();
      ri.close();
View Full Code Here

  {
    final Model A = createModel();
    final Model B = createModel();
    final Resource S = A.createResource("jena:S");
    final Resource R = A.createResource("jena:R");
    final Property P = A.createProperty("jena:P");
    final RDFNode O = A.createResource("jena:O");
    A.add(S, P, O);
    B.add(S, P, O);
    Assert.assertTrue("X1", A.isIsomorphicWith(B));
    /* */
 
View Full Code Here

  {
    final Model A = createModel();
    createModel();
    final Resource S = A.createResource("jena:S");
    A.createResource("jena:R");
    final Property P = A.createProperty("jena:P");
    final RDFNode O = A.createResource("jena:O");
    final Statement spo = A.createStatement(S, P, O);
    A.add(spo);
    final Statement sps = A.createStatement(S, P, S);
    Assert.assertEquals(sps, spo.changeObject(S));
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.Property

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.