Package de.fuberlin.wiwiss.pubby.sources

Examples of de.fuberlin.wiwiss.pubby.sources.FilteredDataSource


    }

    // If conf:datasetURIPattern is set, then filter the dataset accordingly.
    if (hasProperty(CONF.datasetURIPattern)) {
      final Pattern pattern = Pattern.compile(getString(CONF.datasetURIPattern));
      result = new FilteredDataSource(result) {
        @Override
        public boolean canDescribe(String absoluteIRI) {
          return pattern.matcher(absoluteIRI).find();
        }
      };
    }
   
    IRIRewriter rewriter = IRIRewriter.identity;
   
    // If conf:datasetBase is set (and different from conf:webBase),
    // rewrite the IRIs accordingly
    // Base IRI for IRIs considered to be "in" the data source
    String fullWebBase = configuration.getWebApplicationBaseURI() +
        configuration.getWebResourcePrefix();
    String datasetBase = getIRI(CONF.datasetBase,
        fullWebBase);
    if (!datasetBase.equals(fullWebBase)) {
      rewriter = IRIRewriter.createNamespaceBased(datasetBase, fullWebBase);
    }

    // Escape special characters in IRIs
    rewriter = IRIRewriter.chain(rewriter, new PubbyIRIEscaper(
        fullWebBase, !supportsIRIs()));

    result = new RewrittenDataSource(
        result, rewriter, addSameAsStatements());

    // Determine all browsable namespaces for this dataset
    final Set<String> browsableNamespaces = new HashSet<String>();
    browsableNamespaces.add(fullWebBase);
    for (String iri: getBrowsableNamespaces()) {
      browsableNamespaces.add(iri);
    }
    browsableNamespaces.addAll(configuration.getBrowsableNamespaces());

    // Filter the dataset to keep only those resources in the datasetBase
    // and in browsable namespaces, unless it's an annotation provider
    if (!hasType(CONF.AnnotationProvider)) {
      result = new FilteredDataSource(result) {
        @Override
        public boolean canDescribe(String absoluteIRI) {
          for (String namespace: browsableNamespaces) {
            if (absoluteIRI.startsWith(namespace)) return true;
          }
View Full Code Here

TOP

Related Classes of de.fuberlin.wiwiss.pubby.sources.FilteredDataSource

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.