Package org.openrdf.model

Examples of org.openrdf.model.Resource


      return cardinalities.get(key).longValue();
    }

    @Override
    public void meet(StatementPattern sp) {
      final Resource subj = (Resource)getConstantValue(sp.getSubjectVar());
      final URI pred = (URI)getConstantValue(sp.getPredicateVar());
      final Value obj = getConstantValue(sp.getObjectVar());
      final Resource context = (Resource)getConstantValue(sp.getContextVar());
      List<Value> key = Arrays.asList(subj, pred, obj, context);

      if (cardinalities.containsKey(key)) {
        for (int i = 0, n = members.size(); i < n; i++) {
          latch.countDown(); // run down latch
View Full Code Here


  public Statement sign(Statement st) {
    if (st == null) {
      return null;
    }
    Resource subj = sign(st.getSubject());
    Value obj = sign(st.getObject());
    Resource ctx = sign(st.getContext());
    return new StatementImpl(subj, st.getPredicate(), obj, ctx);
  }
View Full Code Here

  @Override
  public void add(Resource subj, URI pred, Value obj, Resource... contexts)
    throws StoreException
  {
    Resource s = signer.internalize(subj);
    Value o = signer.internalize(obj);
    Resource[] c = signer.internalize(contexts);
    super.add(s, pred, o, c);
  }
View Full Code Here

      ServerConnection connection = getConnection();
      ValueFactory vf = connection.getValueFactory();

      StatementPatternParams spParams = new StatementPatternParams(getRequest(), vf);

      Resource subj = spParams.getSubject();
      URI pred = spParams.getPredicate();
      Value obj = spParams.getObject();
      Resource[] contexts = spParams.getContext();
      boolean includeInferred = spParams.isIncludeInferred();
View Full Code Here

                "+1.415.555.1242", "+1.415.555.1243"
        };
        for (String tel : tels) {
            assertContains(vVCARD.tel, RDFUtils.uri("tel:" + tel));
        }
        Resource telResource = RDFUtils.uri("tel:+14155551233");
        assertContains(vVCARD.fax, telResource);
        assertContains(vVCARD.workTel, telResource);
        assertContains(vVCARD.homeTel, telResource);
        assertJohn();
    }
View Full Code Here

        assertModelNotEmpty();
        assertStatementsSize(RDF.TYPE, vVCARD.VCard, 4);
        RepositoryResult<Statement> repositoryResult = getStatements(null, RDF.TYPE, vVCARD.VCard);
        try {
            while (repositoryResult.hasNext()) {
                Resource card = repositoryResult.next().getSubject();
                Assert.assertNotNull(findObject(card, vVCARD.fn));
                String name = findObjectAsLiteral(card, vVCARD.fn);

                Assert.assertNotNull(findObject(card, vVCARD.org));
                Resource org = findObjectAsResource(card, vVCARD.org);
                Assert.assertNotNull(findObject(org, vVCARD.organization_name));

                if (name.equals("Dan Connolly")) {
                    Assert.assertNotNull(findObject(card, vVCARD.n));
                    Assert.assertFalse(name.equals(org.stringValue()));
                }
            }
        } finally {
            repositoryResult.close();
        }
View Full Code Here

        assertStatementsSize(vVCARD.email, (Value) null, 3);

        RepositoryResult<Statement> statements = getStatements(null, RDF.TYPE, vVCARD.VCard);
        try {
            while (statements.hasNext()) {
                Resource vcard = statements.next().getSubject();

                Assert.assertNotNull(findObject(vcard, vVCARD.fn));
                Assert.assertEquals("Brian Suda", findObjectAsLiteral(vcard, vVCARD.fn));

                Assert.assertNotNull(findObject(vcard, vVCARD.url));
                String url = findObjectAsResource(vcard, vVCARD.url).stringValue();
                Assert.assertEquals("http://suda.co.uk/", url);

                Resource name = findObjectAsResource(vcard, vVCARD.n);
                Assert.assertEquals(
                        "Brian",
                        findObjectAsLiteral(name, vVCARD.given_name)
                );
                Assert.assertEquals(
View Full Code Here

        // check fn, name, family, nick.
        assertJohn();

        RepositoryResult<Statement> statements = getStatements(null, RDF.TYPE, vVCARD.VCard);
        try {
            Resource example = RDFUtils.uri("http://example.org/");
            while (statements.hasNext()) {
                Resource card = statements.next().getSubject();
                Assert.assertNotNull( findObject(card, vVCARD.fn) );

                String fn = findObjectAsLiteral(card, vVCARD.fn);
                if ("Jane Doe".equals(fn)) {
                    assertNotFound(card, vVCARD.org);
                } else {
                    Assert.assertTrue("John Doe".equals(fn) || "Brian Suda".equals(fn));

                    Assert.assertNotNull( findObject(card, vVCARD.url));
                    Assert.assertEquals(example, findObjectAsResource(card, vVCARD.url));

                    Assert.assertNotNull( findObject(card, vVCARD.org) );
                    Resource org = findObjectAsResource(card, vVCARD.org);
                    assertContains(org, RDF.TYPE, vVCARD.Organization);
                    Assert.assertNotNull(org);
                    Assert.assertNotNull( findObject(card, vVCARD.org) );
                    Assert.assertNotNull( findObject(org , vVCARD.organization_name) );
                    Assert.assertEquals(
View Full Code Here

        assertModelNotEmpty();
        assertStatementsSize(RDF.TYPE, vVCARD.VCard, 5);

        RepositoryResult<Statement> statements = getStatements(null, RDF.TYPE, vVCARD.VCard);
        while (statements.hasNext()) {
            Resource vcard = statements.next().getSubject();
            final Value fnValue = findObject(vcard, vVCARD.fn);
            Assert.assertNotNull(fnValue);
            String fn = fnValue.stringValue();
            final Value vcardValue = findObject(vcard, vVCARD.url);
            Assert.assertNotNull(vcardValue);
View Full Code Here

        assertStatementsSize(RDF.TYPE, vVCARD.VCard, 4);
        RepositoryResult<Statement> statements = getStatements(null, RDF.TYPE, vVCARD.VCard);

        try {
            while (statements.hasNext()) {
                Resource vcard = statements.next().getSubject();
                Assert.assertNotNull( findObject(vcard, vVCARD.fn) );
                String fn =  findObjectAsLiteral(vcard, vVCARD.fn);
                Assert.assertEquals("Ryan King", fn);

                Assert.assertNotNull( findObject(vcard,vVCARD.n) );
                Resource n = findObjectAsResource(vcard, vVCARD.n);
                Assert.assertNotNull(n);
                Assert.assertNotNull(findObject(n, vVCARD.given_name) );
                Assert.assertEquals("Ryan",  findObjectAsLiteral( n, vVCARD.given_name) );
                Assert.assertNotNull( findObject(n, vVCARD.family_name) );
                Assert.assertEquals("King", findObjectAsLiteral(n, vVCARD.family_name) );

                Assert.assertNotNull( findObject(vcard, vVCARD.url) );
                Resource url = findObjectAsResource(vcard, vVCARD.url);

                Assert.assertNotNull( findObject(vcard, vVCARD.uid) );
                String uid = findObjectAsLiteral(vcard, vVCARD.uid);

                Assert.assertEquals("http://theryanking.com/contact/", url.stringValue() );
                Assert.assertEquals("http://theryanking.com/contact/", uid);
            }
        } finally {
            statements.close();
        }
View Full Code Here

TOP

Related Classes of org.openrdf.model.Resource

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.