Package org.apache.clerezza.rdf.core

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


                    .getDataType().getUnicodeString()));
        } else if (resource instanceof PlainLiteral) {
            value = doc.createElement("literal");
            value.appendChild(doc.createTextNode(((PlainLiteral) resource)
                    .getLexicalForm()));
            Language lang = ((PlainLiteral) resource).getLanguage();
            if (lang != null) {
                value.setAttribute("xml:lang", (lang.toString()));
            }
        } else {
            value = doc.createElement("bnode");
            value.appendChild(doc.createTextNode(((BNode) resource).toString()));
        }
View Full Code Here


                new Variable("a"), new Variable("x"),
                new PlainLiteralImpl("tiger"))));

        Assert.assertTrue(triplePatterns.contains(new SimpleTriplePattern(
                new Variable("a"), new Variable("x"),
                new PlainLiteralImpl("lion", new Language("en")))));
    }
View Full Code Here

   *
   * @param ci
   *            the {@link ContentItem}
   */
  public void computeEnhancements(ContentItem ci) throws EngineException {
    Language language = SpotlightEngineUtils.getContentLanguage(ci);
    String text = SpotlightEngineUtils.getPlainContent(ci);

    Collection<SurfaceForm> dbpslGraph = doPostRequest(text,ci.getUri());
    if (dbpslGraph != null) {
      // Acquire a write lock on the ContentItem when adding the
View Full Code Here

     * @param ci
     * @param linkedEntities
     * @param language
     */
    private void writeEnhancements(ContentItem ci, Collection<LinkedEntity> linkedEntities, String language) {
        Language languageObject = null;
        if(language != null && !language.isEmpty()){
            languageObject = new Language(language);
        }
        Set<UriRef> dereferencedEntitis = new HashSet<UriRef>();
       
        MGraph metadata = ci.getMetadata();
        for(LinkedEntity linkedEntity : linkedEntities){
View Full Code Here

   *
   * @param ci
   *            the {@link ContentItem}
   */
  public void computeEnhancements(ContentItem ci) throws EngineException {
    Language language = SpotlightEngineUtils.getContentLanguage(ci);
    String text = SpotlightEngineUtils.getPlainContent(ci);

    Collection<SurfaceForm> dbpslGraph = doPostRequest(text,ci.getUri());
    if (dbpslGraph != null) {
      // Acquire a write lock on the ContentItem when adding the
View Full Code Here

   *
   * @param ci
   *            the {@link ContentItem}
   */
  public void computeEnhancements(ContentItem ci) throws EngineException {
    Language language = SpotlightEngineUtils.getContentLanguage(ci);
    String text = SpotlightEngineUtils.getPlainContent(ci);


    // Retrieve the existing text annotations (requires read lock)
    MGraph graph = ci.getMetadata();
View Full Code Here

   *
   * @param ci
   *            the {@link ContentItem}
   */
  public void computeEnhancements(ContentItem ci) throws EngineException {
    Language language = SpotlightEngineUtils.getContentLanguage(ci);
    String text = SpotlightEngineUtils.getPlainContent(ci);

    Collection<Annotation> dbpslGraph = doPostRequest(text,ci.getUri());
    if (dbpslGraph != null) {
      // Acquire a write lock on the ContentItem when adding the
View Full Code Here

            + ci.getUri() + " is not supported by this Engine: "
            + "This is also checked in the canEnhance method! -> This "
          + "indicated an Bug in the implementation of the "
          + "EnhancementJobManager!");
    } else {
      return lang == null || lang.isEmpty() ? null : new Language(lang);
    }
  }
View Full Code Here

      EnhancementEngine engine, ContentItem ci, UriRef textAnnotation) {
    UriRef entityAnnotation = EnhancementEngineHelper
        .createEntityEnhancement(ci, engine);
    MGraph model = ci.getMetadata();
    Literal label = new PlainLiteralImpl(resource.label,
        new Language("en"));
    model.add(new TripleImpl(entityAnnotation, DC_RELATION,
        textAnnotation));
    model.add(new TripleImpl(entityAnnotation,
        ENHANCER_ENTITY_LABEL, label));
    model.add(new TripleImpl(entityAnnotation,
View Full Code Here

            PlainLiteral actLabel = labels.next();
            if(label == null){
                label = actLabel;
            }
            //now we have already a label check the language
            Language actLang = actLabel.getLanguage();
            //use startWith to match also en-GB and en-US ...
            if (actLang != null && actLang.toString().startsWith(language)) {
                //prefer labels with the correct language
                label = actLabel;
                if(matchedLabel != null && matchedLabel.getLexicalForm().equalsIgnoreCase(label.getLexicalForm())){
                    //found label in that language that exactly matches the
                    //label used to match the text
View Full Code Here

TOP

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

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.