Package org.apache.clerezza.rdf.core

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


   * bundle., e.g. "http://www.lingvoj.org/lang/de".
   *
   * @param languageUri The language uri which specifies the language
   */
  public GraphNode getLanguageNode(NonLiteral langUri) {
    Graph lingvojRdf = getLingvojGraph();
    return new GraphNode(langUri, lingvojRdf);
  }
View Full Code Here


      writeLock.unlock();
    }
  }

  private Graph getLanguageContext(NonLiteral langUri) {
    Graph lingvojRdf = getLingvojGraph();
    GraphNode languageNode = new GraphNode(langUri, lingvojRdf);
    return languageNode.getNodeContext();
  }
View Full Code Here

    GraphNode languageNode = new GraphNode(langUri, lingvojRdf);
    return languageNode.getNodeContext();
  }
 
  private Graph getLingvojGraph() {
    Graph lingvojGraph = softLingvojGraph.get();
    if (lingvojGraph != null) {
      return lingvojGraph;
    }
    URL config = getClass().getResource("lingvoj.rdf");
    if (config == null) {
View Full Code Here

  }

  @Before
  public void setUp() {

    final Graph graph = Parser.getInstance()
        .parse(getClass().getResourceAsStream("systemgraph.nt"),
            "text/rdf+n3");   
    this.permissionDefinitions = new PermissionDefinitions(
        new SimpleMGraph(graph.iterator()));

    this.allPermissions = new PermissionInfo[] {
        new PermissionInfo(
            "(java.io.FilePermission \"file:///home/foo/-\" \"read,write,delete\")"),
        new PermissionInfo(
View Full Code Here

      if (triple == null) {
        break;
      }
      final GraphNode objectGN = new GraphNode(triple.getObject(), unGroundedTriples);
      NonLiteral subject = triple.getSubject();
      Graph context = objectGN.getNodeContext();
      Iterator<Triple> potentialIter = mGraph.filter(subject, triple.getPredicate(), null);
      while (potentialIter.hasNext()) {
        try {
          final Triple potentialTriple = potentialIter.next();
          BNode potentialMatch = (BNode)potentialTriple.getObject();
          final Graph potentialContext = new GraphNode(potentialMatch, mGraph).getNodeContext();
          if (potentialContext.equals(context)) {
            removingTriples.addAll(potentialContext);
            unGroundedTriples.removeAll(context);
            continue OBJ_BNODE_LOOP;
          }
        } catch (ClassCastException e) {
          continue;
        }
      }
      throw new NoSuchSubGraphException();
    }
    SUBJ_BNODE_LOOP: while (true) {
      final Triple triple = getTripleWithBNodeSubject(unGroundedTriples);
      if (triple == null) {
        break;
      }
      final GraphNode subjectGN = new GraphNode(triple.getSubject(), unGroundedTriples);
      Resource object = triple.getObject();
      if (object instanceof BNode) {
        object = null;
      }
      Graph context = subjectGN.getNodeContext();
      Iterator<Triple> potentialIter = mGraph.filter(null, triple.getPredicate(), object);
      while (potentialIter.hasNext()) {
        try {
          final Triple potentialTriple = potentialIter.next();
          BNode potentialMatch = (BNode)potentialTriple.getSubject();
          final Graph potentialContext = new GraphNode(potentialMatch, mGraph).getNodeContext();
          if (potentialContext.equals(context)) {
            removingTriples.addAll(potentialContext);
            unGroundedTriples.removeAll(context);
            continue SUBJ_BNODE_LOOP;
          }
        } catch (ClassCastException e) {
View Full Code Here

   *            the search term that the concepts have to match against
   */
  private void retrieveConcepts(ConceptProvider conceptProvider,
      boolean first, GraphNode resultNode, String searchTerm) {
    MGraph resultMGraph = (MGraph) resultNode.getGraph();
    Graph graph = conceptProvider.retrieveConcepts(searchTerm);
    Iterator<Triple> concepts = graph.filter(null, RDF.type, SKOS.Concept);
    if (first) {
      while (concepts.hasNext()) {
        resultNode.addProperty(QUERYRESULT.concept, concepts.next()
            .getSubject());
      }
View Full Code Here

      }
    } else {
      mode = "append";
    }
    InputStream is = new ByteArrayInputStream(graph);
    Graph parsedGraph = parser.parse(is, mediaType.toString());
    UriRef graphUri = new UriRef(graphName);
    LockableMGraph mGraph;
    boolean newGraph = false;
    try {
      mGraph = tcManager.getMGraph(graphUri);
View Full Code Here

        os.write(param.getBytes());
        os.close();

        if (con.getResponseCode() < 400) {
          final InputStream is = con.getInputStream();
          Graph parsedGraph = Parser.getInstance().parse(is,
              SupportedFormat.RDF_XML);
          is.close();
          conceptCache.cache(searchTerm.toLowerCase(), parsedGraph);
          remoteConceptsDescriptionManager.storeConceptsDescription(parsedGraph);
          return parsedGraph;
View Full Code Here

    graphAccess.unbindWeightedTcProvider(weightedBlight);
  }

  @Test
  public void getGraphFromA() {
    Graph graphA = graphAccess.getGraph(uriRefA);
    Iterator<Triple> iterator = graphA.iterator();
    assertEquals(new TripleImpl(uriRefA, uriRefA, uriRefA), iterator.next());
    assertFalse(iterator.hasNext());
    TripleCollection triplesA = graphAccess.getTriples(uriRefA);
    iterator = triplesA.iterator();
    assertEquals(new TripleImpl(uriRefA, uriRefA, uriRefA), iterator.next());
View Full Code Here

    assertFalse(iterator.hasNext());
  }

  @Test
  public void getGraphFromB() {
    Graph graphA = graphAccess.getGraph(uriRefB);
    Iterator<Triple> iterator = graphA.iterator();
    assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
    assertFalse(iterator.hasNext());
    TripleCollection triplesA = graphAccess.getTriples(uriRefB);
    iterator = triplesA.iterator();
    assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
View Full Code Here

TOP

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

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.