Examples of createTypedLiteral()


Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

          //add selected text as PlainLiteral in the language extracted from the text
          g.add(new TripleImpl(textAnnotation, ENHANCER_SELECTED_TEXT,  new PlainLiteralImpl(se.getSnippetStr(),lang)));
          g.add(new TripleImpl(textAnnotation, DC_TYPE, CeliConstants.SENTIMENT_EXPRESSION));
          if (se.getStartSnippet() != null && se.getEndSnippet() != null) {
            g.add(new TripleImpl(textAnnotation, ENHANCER_START, literalFactory.createTypedLiteral(se.getStartSnippet().intValue())));
            g.add(new TripleImpl(textAnnotation, ENHANCER_END, literalFactory.createTypedLiteral(se.getEndSnippet().intValue())));
            g.add(new TripleImpl(textAnnotation, ENHANCER_SELECTION_CONTEXT,
                  new PlainLiteralImpl(getSelectionContext(text, se.getSnippetStr(), se.getStartSnippet()), lang)));
            g.add(new TripleImpl(textAnnotation, CeliConstants.HAS_SENTIMENT_EXPRESSION_POLARITY, literalFactory.createTypedLiteral(se.getSentimentPolarityAsDoubleValue())));
          }
        } catch (NoConvertorException e) {
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

          if (se.getStartSnippet() != null && se.getEndSnippet() != null) {
            g.add(new TripleImpl(textAnnotation, ENHANCER_START, literalFactory.createTypedLiteral(se.getStartSnippet().intValue())));
            g.add(new TripleImpl(textAnnotation, ENHANCER_END, literalFactory.createTypedLiteral(se.getEndSnippet().intValue())));
            g.add(new TripleImpl(textAnnotation, ENHANCER_SELECTION_CONTEXT,
                  new PlainLiteralImpl(getSelectionContext(text, se.getSnippetStr(), se.getStartSnippet()), lang)));
            g.add(new TripleImpl(textAnnotation, CeliConstants.HAS_SENTIMENT_EXPRESSION_POLARITY, literalFactory.createTypedLiteral(se.getSentimentPolarityAsDoubleValue())));
          }
        } catch (NoConvertorException e) {
          log.error(e.getMessage(), e);
        }
      }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

        for (CeliMorphoFeatures feat : mFeatures) {
          // Create a text annotation for each interpretation produced by the morphological analyzer
          UriRef textAnnotation = EnhancementEngineHelper.createTextEnhancement(ci, this);
          g.add(new TripleImpl(textAnnotation, ENHANCER_SELECTED_TEXT, new PlainLiteralImpl(le.getWordForm(), lang)));
          if (le.from >= 0 && le.to > 0) {
            g.add(new TripleImpl(textAnnotation, ENHANCER_START, literalFactory.createTypedLiteral(le.from)));
            g.add(new TripleImpl(textAnnotation, ENHANCER_END, literalFactory.createTypedLiteral(le.to)));
            g.add(new TripleImpl(textAnnotation, ENHANCER_SELECTION_CONTEXT, new PlainLiteralImpl(getSelectionContext(text, le.getWordForm(), le.from), lang)));
          }
          g.addAll(feat.featuresAsTriples(textAnnotation, lang));
        }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

          // Create a text annotation for each interpretation produced by the morphological analyzer
          UriRef textAnnotation = EnhancementEngineHelper.createTextEnhancement(ci, this);
          g.add(new TripleImpl(textAnnotation, ENHANCER_SELECTED_TEXT, new PlainLiteralImpl(le.getWordForm(), lang)));
          if (le.from >= 0 && le.to > 0) {
            g.add(new TripleImpl(textAnnotation, ENHANCER_START, literalFactory.createTypedLiteral(le.from)));
            g.add(new TripleImpl(textAnnotation, ENHANCER_END, literalFactory.createTypedLiteral(le.to)));
            g.add(new TripleImpl(textAnnotation, ENHANCER_SELECTION_CONTEXT, new PlainLiteralImpl(getSelectionContext(text, le.getWordForm(), le.from), lang)));
          }
          g.addAll(feat.featuresAsTriples(textAnnotation, lang));
        }
      }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

                /*
                 * if this object has already has name and path annotations, it means that it's already
                 * processed as child of another object. So, don't put new name annotations
                 */
                if (!graph.filter(subject, CMSAdapterVocabulary.CMS_OBJECT_NAME, null).hasNext()) {
                    graph.add(new TripleImpl(subject, CMSAdapterVocabulary.CMS_OBJECT_NAME, literalFactory
                            .createTypedLiteral(name)));
                }

                // check children and add child and parent annotations
                checkChildren(subject, processedURIs, graph);
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

                    graph.add(new TripleImpl(childSubject, RDFBridgeHelper.RDF_TYPE,
                            CMSAdapterVocabulary.CMS_OBJECT));
                    graph.add(new TripleImpl(childSubject, CMSAdapterVocabulary.CMS_OBJECT_PARENT_REF,
                            objectURI));
                    graph.add(new TripleImpl(childSubject, CMSAdapterVocabulary.CMS_OBJECT_NAME,
                            literalFactory.createTypedLiteral(checkDuplicateChildName(childName, childNames))));

                } else {
                    log.warn("Failed to obtain a name for child property: {}", childPropURI);
                }
            }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

                g.add(latitudes.next());
            }
            Iterator<Triple> longitutes = metadata.filter(uri, GEO_LONG, null);
            if (longitutes.hasNext()) {
                g.add(longitutes.next());
                g.add(new TripleImpl(uri, Properties.RDFS_LABEL, lf.createTypedLiteral(bestGuess.getLabel())));
            }
        }
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        serializer.serialize(out, g, SupportedFormat.RDF_JSON);
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

                            continue;
                        }
                    } catch (Exception e) {
                        // ignore the exception
                    }
                    graph.add(new TripleImpl(subject, pURI, literalFactory.createTypedLiteral(val)));
                }
            } catch (RepositoryException e) {
                log.warn("Failed to process property of node", e);
            }
        }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

    public void testFloat(){
        MGraph graph = new IndexedMGraph();
        UriRef id = new UriRef("http://www.example.org/test");
        UriRef doubleTestField = new UriRef("http://www.example.org/field/double");
        LiteralFactory lf = LiteralFactory.getInstance();
        graph.add(new TripleImpl(id, doubleTestField, lf.createTypedLiteral(Float.NaN)));
        graph.add(new TripleImpl(id, doubleTestField, lf.createTypedLiteral(Float.POSITIVE_INFINITY)));
        graph.add(new TripleImpl(id, doubleTestField, lf.createTypedLiteral(Float.NEGATIVE_INFINITY)));
       
        RdfValueFactory vf = new RdfValueFactory(graph);
        Representation r = vf.createRepresentation(id.getUnicodeString());
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

        MGraph graph = new IndexedMGraph();
        UriRef id = new UriRef("http://www.example.org/test");
        UriRef doubleTestField = new UriRef("http://www.example.org/field/double");
        LiteralFactory lf = LiteralFactory.getInstance();
        graph.add(new TripleImpl(id, doubleTestField, lf.createTypedLiteral(Float.NaN)));
        graph.add(new TripleImpl(id, doubleTestField, lf.createTypedLiteral(Float.POSITIVE_INFINITY)));
        graph.add(new TripleImpl(id, doubleTestField, lf.createTypedLiteral(Float.NEGATIVE_INFINITY)));
       
        RdfValueFactory vf = new RdfValueFactory(graph);
        Representation r = vf.createRepresentation(id.getUnicodeString());
        Set<Float> expected = new HashSet<Float>(Arrays.asList(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.