Package org.apache.clerezza.rdf.core

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


  @Test
  public void baseUriTransformationNoSymbolicName() {
    MGraph mGraph = new SimpleMGraph();
    String xml = "<a href=\"" + UriMutatorIterator.BASE_URI_PLACEHOLDER +
      "/bla\"/>";
    Literal literal = new TypedLiteralImpl(xml,
          UriMutatorIterator.XML_LITERAL);
    String expectedXml = "<a href=\"" + HOST +
      "bundle-doc/"+ ORIGIN_BUNDLE_NAME +"/bla\"/>";
    Literal expectedLiteral = new TypedLiteralImpl(expectedXml,
          UriMutatorIterator.XML_LITERAL);
    UriRef uriRef = new UriRef("bla");
      mGraph.add(new TripleImpl(uriRef, uriRef, literal));
    Iterator<Triple> it = new UriMutatorIterator(mGraph.iterator(), HOST,
        ORIGIN_BUNDLE_NAME);
View Full Code Here


    BNode bNode2 = new BNode();
    BNode newBnode = new BNode();
    UriRef property1 = new UriRef("http://example.org/property1");
    UriRef property2 = new UriRef("http://example.org/property2");
    UriRef newUriRef = new UriRef("http://example.org/newName");
    Literal literal1 = new PlainLiteralImpl("literal");
    Literal literal2 = new PlainLiteralImpl("bla bla");

    Triple triple1 = new TripleImpl(bNode1, property1, literal1);
    Triple triple2 = new TripleImpl(bNode1, property2, property1);
    Triple triple3 = new TripleImpl(bNode2, property2, bNode1);
    Triple triple4 = new TripleImpl(property1, property1, bNode2);
View Full Code Here

          systemGraph.filter(permission, PERMISSION.javaPermissionEntry, null);

      while (javaPermissionTriples.hasNext()) {

        Triple t = javaPermissionTriples.next();
        Literal permEntry = (Literal) t.getObject();

        permInfoList.add(new PermissionInfo(permEntry.getLexicalForm()));
      }
    }

    Iterator<Triple> roleTriples =
        systemGraph.filter(role, SIOC.has_function, null);
View Full Code Here

        }
        target.createGraph((UriRef)graphGN.getNode(), extracted);
      }
    }
    for (Map.Entry<String, TripleCollection> pathTcPair : extractedTc.entrySet()) {
      Literal fileNameLit = LiteralFactory.getInstance().createTypedLiteral(
            pathTcPair.getKey());
      Iterator<Triple> graphResIterator = metaGraph.filter(null, BACKUP.file, fileNameLit);
    }
  }
View Full Code Here

      height = Integer.MAX_VALUE;
    }
    GraphNode infoBitNode = new GraphNode(infoBitUri, cgProvider.getContentGraph());
    UriRef thumbnailUri = getGeneratedThumbnailUri(infoBitNode, width, height, exact);
    if (thumbnailUri == null) {
      Literal mediaTypeLiteral = null;
      Lock readLock = infoBitNode.readLock();
      readLock.lock();
      try {
        Iterator<Resource> mediaTypes = infoBitNode.getObjects(DISCOBITS.mediaType);
        if (mediaTypes.hasNext()) {
          mediaTypeLiteral = (Literal) mediaTypes.next();
        }
      } finally {
        readLock.unlock();
      }
      if (mediaTypeLiteral != null) {
        MediaType mediaType = MediaType.valueOf(mediaTypeLiteral.getLexicalForm());
        // if the infoBit is an image, create a thumbnail on the fly.
        if (mediaType.getType().startsWith("image")) {
          try {
            thumbnailUri = altRepGen.generateAlternativeImage(infoBitNode, width,
                height, exact);
View Full Code Here

    }

    @Override
    public void run() {
      while (!stopRequested) {
        Literal randomLiteral = new PlainLiteralImpl(Util.createRandomString(22));
        Triple triple = new TripleImpl(new BNode(), new UriRef("http://example.com/property"), randomLiteral);
        mGraph.add(triple);
        addedTripleCount++;
        if ((addedTripleCount % 100) == 0) {
          testTriples.add(triple);
View Full Code Here

                    log.trace(" {}. {}", i++,  match.getUri());
                }
                matchCount++;
                if(!filterEntityByType(match.getTypes().iterator())){
                    int distance = Integer.MAX_VALUE;
                    Literal matchLabel = null;
                    for(Iterator<Literal> it = match.getLabels().iterator(); it.hasNext() && distance > 0;){
                        Literal literal = it.next();
                        String label = literal.getLexicalForm();
                        int d;
                        if(!elConfig.isCaseSensitiveMatching()){
                            label = label.toLowerCase(Locale.ROOT);
                        }
                        d = StringUtils.getLevenshteinDistance(anchor, label);
View Full Code Here

       
        MGraph metadata = ci.getMetadata();
        for(Tag tag : tags){
            Collection<UriRef> textAnnotations = new ArrayList<UriRef>(tags.size());
            //first create the TextAnnotations for the Occurrences
            Literal startLiteral = literalFactory.createTypedLiteral(tag.getStart());
            Literal endLiteral = literalFactory.createTypedLiteral(tag.getEnd());
            //search for existing text annotation
            Iterator<Triple> it = metadata.filter(null, ENHANCER_START, startLiteral);
            UriRef textAnnotation = null;
            while(it.hasNext()){
                Triple t = it.next();
View Full Code Here

            while (resultSet.hasNext()) {
                SolutionMapping solutionMapping = resultSet.next();
                UriRef recipeID = (UriRef) solutionMapping.get("recipe");
                UriRef ruleID = (UriRef) solutionMapping.get("rule");
                Literal description = (Literal) solutionMapping.get("description");

                try {
                    Recipe recipe = getRecipe(recipeID);
                    Rule rule = new RecipeRule(recipe, getRule(recipe, ruleID));
                    if (description != null) {
                        rule.setDescription(description.getLexicalForm());
                    }

                    matchingRules.add(rule);
                } catch (NoSuchRecipeException e) {
                    // in this case go on in the iteration by fetching other matching recipes
View Full Code Here

            while (resultSet.hasNext()) {
                SolutionMapping solutionMapping = resultSet.next();
                UriRef recipeID = (UriRef) solutionMapping.get("recipe");
                UriRef ruleID = (UriRef) solutionMapping.get("rule");
                Literal description = (Literal) solutionMapping.get("description");

                try {
                    Recipe recipe = getRecipe(recipeID);
                    Rule rule = new RecipeRule(recipe, getRule(recipe, ruleID));
                    if (description != null) {
                        rule.setDescription(description.getLexicalForm());
                    }

                    matchingRules.add(rule);
                } catch (NoSuchRecipeException e) {
                    // in this case go on in the iteration by fetching other matching recipes
View Full Code Here

TOP

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

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.