Package org.apache.clerezza.rdf.core

Examples of org.apache.clerezza.rdf.core.NonLiteral


    final LockableMGraph permissionMGraph = getOrCreatePermisionGraph();
    Lock l = permissionMGraph.getLock().writeLock();
    l.lock();
    try {
      removeExistingRequiredReadPermissions(tripleCollectionUri, permissionMGraph);
      final NonLiteral permissionList = createList(permissionDescriptions.iterator(), permissionMGraph);
      permissionMGraph.add(new TripleImpl(tripleCollectionUri,
          readWritePermissionListProperty, permissionList));
    } finally {
      l.unlock();
    }
View Full Code Here


      final LockableMGraph permissionMGraph = tcManager.getMGraph(permissionGraphName);
      Lock l = permissionMGraph.getLock().readLock();
      l.lock();
      try {
        Triple t = permissionMGraph.filter(tripleCollectionUri, property, null).next();
        NonLiteral list = (NonLiteral) t.getObject();
        LinkedList<String> result = new LinkedList<String>();
        readList(list, permissionMGraph, result);
        return result;
      } catch (NoSuchElementException e) {
        return new ArrayList<String>(0);
View Full Code Here

  private void readList(NonLiteral list, LockableMGraph permissionMGraph, LinkedList<String> target) {
    if (list.equals(rdfNil)) {
      return;
    }
    Triple restTriple = permissionMGraph.filter(list, rest, null).next();
    NonLiteral restList = (NonLiteral) restTriple.getObject();
    readList(restList, permissionMGraph, target);
    Triple firstTriple = permissionMGraph.filter(list, first, null).next();
    TypedLiteral firstValue = (TypedLiteral) firstTriple.getObject();
    String value = LiteralFactory.getInstance().createObject(String.class, firstValue);
    target.addFirst(value);
View Full Code Here

      }
      final BNode bNode1 = nodes1.iterator().next();
      final BNode bNode2 = nodes2.iterator().next();
      matchings.put(bNode1,bNode2);
      //in the graphs replace node occurences with grounded node,
      NonLiteral mappedNode = new MappedNode(bNode1, bNode2);
      replaceNode(g1,bNode1, mappedNode);
      replaceNode(g2, bNode2, mappedNode);
      //remove grounded triples
      if (!Utils.removeGrounded(g1,g2)) {
        return null;
View Full Code Here

  private MGraph generateCircle(int size, final NonLiteral firstNode) {
    if (size < 1) {
      throw new IllegalArgumentException();
    }
    MGraph result = new SimpleMGraph();
    NonLiteral lastNode = firstNode;
    for (int i = 0; i < (size-1); i++) {
      final BNode newNode = new BNode();
      result.add(new TripleImpl(lastNode, u1, newNode));
      lastNode = newNode;
    }
View Full Code Here

    Assert.assertEquals(5, mapping.size());
  }

  @Test
  public void test9() {
    NonLiteral crossing = new UriRef("http://example.org/");
    TripleCollection tc1 = generateCircle(2,crossing);
    tc1.addAll(generateCircle(3,crossing));
    TripleCollection tc2 = generateCircle(2,crossing);
    tc2.addAll(generateCircle(3,crossing));
    Assert.assertEquals(5, tc1.size());
View Full Code Here

    Assert.assertEquals(3, mapping.size());
  }

  @Test
  public void test10() {
    NonLiteral crossing1 = new BNode();
    TripleCollection tc1 = generateCircle(2,crossing1);
    tc1.addAll(generateCircle(3,crossing1));
    NonLiteral crossing2 = new BNode();
    TripleCollection tc2 = generateCircle(2,crossing2);
    tc2.addAll(generateCircle(3,crossing2));
    Assert.assertEquals(5, tc1.size());
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNotNull(mapping);
View Full Code Here

    Assert.assertEquals(4, mapping.size());
  }

  @Test
  public void test11() {
    NonLiteral crossing1 = new BNode();
    TripleCollection tc1 = generateCircle(2,crossing1);
    tc1.addAll(generateCircle(4,crossing1));
    NonLiteral crossing2 = new BNode();
    TripleCollection tc2 = generateCircle(3,crossing2);
    tc2.addAll(generateCircle(3,crossing2));
    Assert.assertEquals(6, tc1.size());
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNull(mapping);
View Full Code Here

    Assert.assertNull(mapping);
  }

  @Test
  public void test12() {
    NonLiteral start1 = new BNode();
    TripleCollection tc1 = Utils4Testing.generateLine(4,start1);
    tc1.addAll(Utils4Testing.generateLine(5,start1));
    NonLiteral start2 = new BNode();
    TripleCollection tc2 = Utils4Testing.generateLine(5,start2);
    tc2.addAll(Utils4Testing.generateLine(4,start2));
    Assert.assertEquals(9, tc1.size());
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNotNull(mapping);
View Full Code Here

    Assert.assertEquals(10, mapping.size());
  }

  @Test
  public void test13() {
    NonLiteral start1 = new BNode();
    TripleCollection tc1 = Utils4Testing.generateLine(4,start1);
    tc1.addAll(Utils4Testing.generateLine(5,start1));
    NonLiteral start2 = new BNode();
    TripleCollection tc2 = Utils4Testing.generateLine(3,start2);
    tc2.addAll(Utils4Testing.generateLine(3,start2));
    Assert.assertEquals(9, tc1.size());
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNull(mapping);
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.NonLiteral

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.