Package org.apache.jena.query.text

Examples of org.apache.jena.query.text.EntityDefinition


            Collection<Node> c = mapDefs.get(defaultField) ;
            if ( c == null )
                throw new TextIndexException("No definition of primary field '"+defaultField+"'") ;
        }
       
        EntityDefinition docDef = new EntityDefinition(entityField, defaultField, graphField) ;
        for ( String f : mapDefs.keys() ) {
            for ( Node p : mapDefs.get(f))
                docDef.set(f, p) ;
        }
        for (String f : analyzerDefs.keySet()) {
          docDef.setAnalyzer(f, analyzerDefs.get(f));
        }
        return docDef ;
    }
View Full Code Here


        // Base data
        Dataset ds1 = DatasetFactory.createMem() ;

        // Define the index mapping
        EntityDefinition entDef = new EntityDefinition("uri", "text", RDFS.label.asNode()) ;

        // Lucene, in memory.
        Directory dir =  new RAMDirectory();
       
        // Join together into a dataset
View Full Code Here

  private static final Resource specNoMapProperty;
  private static final Resource specNoPrimaryFieldDef;
 
  @Test public void EntityHasPrimaryField() {
    EntityDefinitionAssembler entDefAssem = new EntityDefinitionAssembler();
    EntityDefinition entityDef = entDefAssem.open(null, spec1, null);
    assertEquals(SPEC1_DEFAULT_FIELD, entityDef.getPrimaryField());
  }
View Full Code Here

    assertEquals(SPEC1_DEFAULT_FIELD, entityDef.getPrimaryField());
  }
 
  @Test public void EntityHasEntityField() {
    EntityDefinitionAssembler entDefAssem = new EntityDefinitionAssembler();
    EntityDefinition entityDef = entDefAssem.open(null, spec1, null);
    assertEquals(SPEC1_ENTITY_FIELD, entityDef.getEntityField());   
  }
View Full Code Here

    assertEquals(SPEC1_ENTITY_FIELD, entityDef.getEntityField());   
  }
 
  @Test public void EntityHasMapEntries() {
    EntityDefinitionAssembler entDefAssem = new EntityDefinitionAssembler();
    EntityDefinition entityDef = entDefAssem.open(null, spec1, null);
    assertEquals(SPEC1_PREDICATE.asNode(), getOne(entityDef,SPEC1_DEFAULT_FIELD));
  }
View Full Code Here

        return x.iterator().next() ;
    }

    @Test public void EntityHasMultipleMapEntries() {
    EntityDefinitionAssembler entDefAssem = new EntityDefinitionAssembler();
    EntityDefinition entityDef = entDefAssem.open(null, spec2, null);
    assertEquals(SPEC2_PREDICATE1.asNode(), getOne(entityDef,SPEC2_DEFAULT_FIELD));
    assertEquals(SPEC2_PREDICATE2.asNode(), getOne(entityDef, SPEC2_FIELD2));
  }
View Full Code Here

    assertEquals(SPEC2_PREDICATE2.asNode(), getOne(entityDef, SPEC2_FIELD2));
  }
   
    @Test public void EntityHasMapEntryWithSimpleAnalyzer() {
      EntityDefinitionAssembler entDefAssem = new EntityDefinitionAssembler();
      EntityDefinition entityDef = entDefAssem.open(Assembler.general, spec3,  null);
      assertEquals(SimpleAnalyzer.class, entityDef.getAnalyzer(SPEC1_DEFAULT_FIELD).getClass());
    }
View Full Code Here

      assertEquals(SimpleAnalyzer.class, entityDef.getAnalyzer(SPEC1_DEFAULT_FIELD).getClass());
    }
   
    @Test public void EntityHasMapEntryWithStandardAnalyzerAndStopWords() {
      EntityDefinitionAssembler entDefAssem = new EntityDefinitionAssembler();
      EntityDefinition entityDef = entDefAssem.open(Assembler.general, spec4,  null);
      assertEquals(StandardAnalyzer.class, entityDef.getAnalyzer(SPEC1_DEFAULT_FIELD).getClass());
    }
View Full Code Here

      assertEquals(StandardAnalyzer.class, entityDef.getAnalyzer(SPEC1_DEFAULT_FIELD).getClass());
    }
   
    @Test public void EntityHasMapEntryWithKeywordAnalyzer() {
      EntityDefinitionAssembler entDefAssem = new EntityDefinitionAssembler();
      EntityDefinition entityDef = entDefAssem.open(Assembler.general, spec5,  null);
      assertEquals(KeywordAnalyzer.class, entityDef.getAnalyzer(SPEC1_DEFAULT_FIELD).getClass());
    }   
View Full Code Here

                File dir = new File(path) ;
                directory = FSDirectory.open(dir) ;
            }

            Resource r = GraphUtils.getResourceValue(root, pEntityMap) ;
            EntityDefinition docDef = (EntityDefinition)a.open(r) ;

            return TextDatasetFactory.createLuceneIndex(directory, docDef) ;
        } catch (IOException e) {
            IO.exception(e) ;
            return null ;
View Full Code Here

TOP

Related Classes of org.apache.jena.query.text.EntityDefinition

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.