Package org.apache.clerezza.rdf.core

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


   *
   * @param componentContext
   */
  protected void activate(ComponentContext componentContext) {
    LockableMGraph systemGraph = getSystemGraph();
    NonLiteral listNode = getListNode(systemGraph);

    Lock writeLock = systemGraph.getLock().writeLock();
    writeLock.lock();
    try {
      // the constructor of RdfList might write to the graph! => requires a write lock
View Full Code Here


      writeLock.unlock();
    }
  }

  private NonLiteral getListNode(LockableMGraph systemGraph) {
    NonLiteral instance = null;
    Lock readLock = systemGraph.getLock().readLock();
    readLock.lock();
    try {
      Iterator<Triple> instances = systemGraph.filter(null, RDF.type, PLATFORM.Instance);
      if (!instances.hasNext()) {
View Full Code Here

      String rootLinkPrefix, List<String> formatExtensions) throws IOException {
    Hierarchy result = new Hierarchy("");
    MGraph contentGraph = cgp.getContentGraph();
    Set<UriRef> matchingUri = new HashSet<UriRef>();
    for (Triple triple : contentGraph) {
      final NonLiteral subject = triple.getSubject();
      if ((subject instanceof UriRef) &&
          ((UriRef)subject).getUnicodeString().startsWith(baseUri)) {
        matchingUri.add((UriRef)subject);
      }
    }
View Full Code Here

    TripleCollection tc = provider.getTriples(graphUriRef);
    assertNotNull(tc);
  }

  private Triple createTestTriple() {
    NonLiteral subject = new BNode() {};
    UriRef predicate = new UriRef("http://test.com/");
    NonLiteral object = new UriRef("http://test.com/myObject");
    return new TripleImpl(subject, predicate, object);
  }
View Full Code Here

    LockableMGraph contentGraph = cgProvider.getContentGraph();
    Lock l = contentGraph.getLock().writeLock();
    l.lock();
   
    try {
      NonLiteral binding = getBindingWithValue(bindingValue, contentGraph);
      if (binding == null) {
        binding = new BNode();
      }
      GraphNode bindingNode;
      if (oldBindingValue != null) {
        NonLiteral oldBinding = getBindingWithValue(oldBindingValue, contentGraph);
        if (oldBinding != null) {
          GraphNode oldBindingNode = new GraphNode(oldBinding, contentGraph);
          oldBindingNode.replaceWith(binding);
        }
      }
View Full Code Here

      @FormParam("binding") String bindingValue) {
    LockableMGraph contentGraph = cgProvider.getContentGraph();
    Lock l = contentGraph.getLock().writeLock();
    l.lock();
    try {
      NonLiteral binding = getBindingWithValue(bindingValue, contentGraph);
      GraphNode bindingNode = new GraphNode(binding, contentGraph);
      bindingNode.deleteProperty(RDF.type, CURIE.CuriePrefixBinding);
      bindingNode.deleteProperties(CURIE.prefix);
      bindingNode.deleteProperties(CURIE.binding);
    } finally {
View Full Code Here

  public String getRecommendedPrefix(String iriPrefix) {
    LockableMGraph contentGraph = cgProvider.getContentGraph();
    Lock l = contentGraph.getLock().readLock();
    l.lock();
    try {
      NonLiteral binding = getBindingWithValue(iriPrefix, contentGraph);
      if (binding == null) {
        return null;
      }
      GraphNode graphNode = new GraphNode(binding, contentGraph);
      return ((Literal)graphNode.getObjects(CURIE.prefix).next()).getLexicalForm();
View Full Code Here

public class TripleImplTest {
   
 
  @Test public void tripleEquality() {
    NonLiteral subject = new UriRef("http://example.org/");
    UriRef predicate = new UriRef("http://example.org/property");
    Resource object = new PlainLiteralImpl("property value");
    Triple triple1 = new TripleImpl(subject, predicate, object);
    Triple triple2 = new TripleImpl(subject, predicate, object);
    Assert.assertEquals(triple1.hashCode(), triple2.hashCode());
View Full Code Here

*/
public class HashMatchingTest {

  @Test
  public void twoLine() throws GraphNotIsomorphicException {
    NonLiteral start1 = new BNode();
    MGraph tc1 = Utils4Testing.generateLine(4,start1);
    tc1.addAll(Utils4Testing.generateLine(5,start1));
    NonLiteral start2 = new BNode();
    MGraph tc2 = Utils4Testing.generateLine(5,start2);
    tc2.addAll(Utils4Testing.generateLine(4,start2));
    Assert.assertEquals(9, tc1.size());
    final Map<BNode, BNode> mapping = new HashMatching(tc1, tc2).getMatchings();
    Assert.assertNotNull(mapping);
View Full Code Here

  }

  @Test
  public void inverse() throws IOException {
    TripleCollection mGraph = new SimpleMGraph();
    NonLiteral subject = new UriRef("http://example.org/subject");
    UriRef object = new UriRef("http://example.org/object");
    mGraph.add(new TripleImpl(subject, RDFS.comment, object));
    GraphNode node = new GraphNode(object, mGraph);
    DataFieldResolver dataFieldResolver = new GraphNodeDataFieldResolver(node, simpleFunctions);
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.