Package org.sindice.siren.analysis

Examples of org.sindice.siren.analysis.AnyURIAnalyzer


  throws Exception {
    final String qnames = "./src/test/resources/conf/qnames";
    final HashMap<ConfigurationKey, Object> config = new HashMap<ConfigurationKey, Object>();
    config.put(KeywordConfigurationKeys.QNAMES, this.loadQNamesFile(qnames));
    final Map<String, Analyzer> dts = new HashMap<String, Analyzer>();
    dts.put("uri", new AnyURIAnalyzer(LuceneTestCase.TEST_VERSION_CURRENT));
    config.put(KeywordConfigurationKeys.DATATYPES_ANALYZERS, dts);

    final Query q = ntq("http://xmlns.com/foaf/0.1/name")
                    .setDatatype("uri")
                    .getLuceneProxyQuery();
View Full Code Here


    final String query = "uri('http://ns/#s' 'http://ns/p' 'http://ns/o')";
    final String qnames = "./src/test/resources/conf/qnames";
    final HashMap<ConfigurationKey, Object> config = new HashMap<ConfigurationKey, Object>();
    config.put(KeywordConfigurationKeys.QNAMES, this.loadQNamesFile(qnames));
    final Map<String, Analyzer> dts = new HashMap<String, Analyzer>();
    dts.put("uri", new AnyURIAnalyzer(LuceneTestCase.TEST_VERSION_CURRENT));
    config.put(KeywordConfigurationKeys.DATATYPES_ANALYZERS, dts);

    final Query q = bq(
      must(ntq("http://ns/#s").setDatatype("uri")),
      must(ntq("http://ns/p").setDatatype("uri")),
View Full Code Here

  public void testURIsWithDefaultOR()
  throws Exception {
    final HashMap<ConfigurationKey, Object> config = new HashMap<ConfigurationKey, Object>();
    config.put(ConfigurationKeys.DEFAULT_OPERATOR, Operator.OR);
    final Map<String, Analyzer> dts = new HashMap<String, Analyzer>();
    dts.put("uri", new AnyURIAnalyzer(LuceneTestCase.TEST_VERSION_CURRENT));
    config.put(KeywordConfigurationKeys.DATATYPES_ANALYZERS, dts);

    final Query q = bq(
      should(ntq("http://www.google.com").setDatatype("uri")),
      should(ntq("http://hello.world#me").setDatatype("uri"))
View Full Code Here

  public void testURIsWithDefaultAND()
  throws Exception {
    final HashMap<ConfigurationKey, Object> config = new HashMap<ConfigurationKey, Object>();
    config.put(ConfigurationKeys.DEFAULT_OPERATOR, Operator.AND);
    final Map<String, Analyzer> dts = new HashMap<String, Analyzer>();
    dts.put("uri", new AnyURIAnalyzer(LuceneTestCase.TEST_VERSION_CURRENT));
    config.put(KeywordConfigurationKeys.DATATYPES_ANALYZERS, dts);

    final Query q = bq(
      must(ntq("http://www.google.com").setDatatype("uri")),
      must(ntq("http://hello.world#me").setDatatype("uri"))
View Full Code Here

  public void testCompoundQuery()
  throws Exception {
    final HashMap<ConfigurationKey, Object> config = new HashMap<ConfigurationKey, Object>();
    final Map<String, Analyzer> dts = new HashMap<String, Analyzer>();
    dts.put(XSDDatatype.XSD_STRING, new WhitespaceAnalyzer(LuceneTestCase.TEST_VERSION_CURRENT));
    dts.put("uri", new AnyURIAnalyzer(LuceneTestCase.TEST_VERSION_CURRENT));
    config.put(KeywordConfigurationKeys.DATATYPES_ANALYZERS, dts);

    final Query q = bq(
      should(ntq("http://www.google.com").setDatatype("uri")),
      must(ntq("hello")),
View Full Code Here

  @Test
  public void testWildcardInURI() throws Exception {
    final HashMap<ConfigurationKey, Object> config = new HashMap<ConfigurationKey, Object>();
    final Map<String, Analyzer> dts = new HashMap<String, Analyzer>();
    dts.put("uri", new AnyURIAnalyzer(LuceneTestCase.TEST_VERSION_CURRENT));
    config.put(KeywordConfigurationKeys.DATATYPES_ANALYZERS, dts);

    Query q = ntq("http://example.com/~foo=bar").setDatatype("uri").getLuceneProxyQuery();
    this._assertSirenQuery(config, q, "uri('http://example.com/~foo=bar')");
View Full Code Here

  @Test
  public void testDashedURI() throws Exception {
    final HashMap<ConfigurationKey, Object> config = new HashMap<ConfigurationKey, Object>();
    final Map<String, Analyzer> dts = new HashMap<String, Analyzer>();
    dts.put("uri", new AnyURIAnalyzer(LuceneTestCase.TEST_VERSION_CURRENT));
    config.put(KeywordConfigurationKeys.DATATYPES_ANALYZERS, dts);

    final Query q = ntq("http://semantic-conference.com/session/569")
                    .setDatatype("uri").getLuceneProxyQuery();
    this._assertSirenQuery(config, q, "uri('http://semantic-conference.com/session/569/')");
View Full Code Here

  protected static final Logger logger = LoggerFactory.getLogger(SirenTestCase.class);

  public static final String DEFAULT_TEST_FIELD = "content";

  public static Analyzer newTupleAnalyzer() {
    final AnyURIAnalyzer uriAnalyzer = new AnyURIAnalyzer(TEST_VERSION_CURRENT);
    uriAnalyzer.setUriNormalisation(URINormalisation.FULL);
    final TupleAnalyzer analyzer = new TupleAnalyzer(TEST_VERSION_CURRENT,
      new StandardAnalyzer(TEST_VERSION_CURRENT), uriAnalyzer);
    return analyzer;
  }
View Full Code Here

      new StandardAnalyzer(TEST_VERSION_CURRENT), uriAnalyzer);
    return analyzer;
  }

  public static Analyzer newJsonAnalyzer() {
    final AnyURIAnalyzer fieldAnalyzer = new AnyURIAnalyzer(TEST_VERSION_CURRENT);
    fieldAnalyzer.setUriNormalisation(URINormalisation.FULL);
    final Analyzer literalAnalyzer = new StandardAnalyzer(TEST_VERSION_CURRENT);
    final JsonAnalyzer analyzer = new JsonAnalyzer(TEST_VERSION_CURRENT,
      fieldAnalyzer, literalAnalyzer);
    return analyzer;
  }
View Full Code Here

*/
public class TestNodeWildcardQuery extends BasicSirenTestCase {

  @Override
  protected void configure() throws IOException {
    final AnyURIAnalyzer uriAnalyzer = new AnyURIAnalyzer(TEST_VERSION_CURRENT);
    final TupleAnalyzer tupleAnalyzer = new TupleAnalyzer(TEST_VERSION_CURRENT,
      new WhitespaceAnalyzer(TEST_VERSION_CURRENT), uriAnalyzer);
    tupleAnalyzer.registerDatatype(XSDDatatype.XSD_ANY_URI.toCharArray(), uriAnalyzer);
    this.setAnalyzer(tupleAnalyzer);
    this.setPostingsFormat(PostingsFormatType.RANDOM);
View Full Code Here

TOP

Related Classes of org.sindice.siren.analysis.AnyURIAnalyzer

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.