All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bigdata.rdf.internal.DefaultExtensionFactory Maven / Gradle / Ivy

package com.bigdata.rdf.internal;

import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

import com.bigdata.rdf.internal.impl.extensions.DateTimeExtension;
import com.bigdata.rdf.internal.impl.extensions.DerivedNumericsExtension;
import com.bigdata.rdf.internal.impl.extensions.GeoSpatialLiteralExtension;
import com.bigdata.rdf.internal.impl.extensions.XSDStringExtension;
import com.bigdata.rdf.model.BigdataLiteral;
import com.bigdata.rdf.model.BigdataValue;
import com.bigdata.service.geospatial.GeoSpatialDatatypeConfiguration;

/**
 * Default {@link IExtensionFactory}. The following extensions are supported:
 * 
*
{@link DateTimeExtension}
*
Inlining literals which represent xsd:dateTime values into * the statement indices.
*
{@link XSDStringExtension}
*
Inlining xsd:string literals into the statement indices.
*
{@link DerivedNumericsExtension}
*
Inlining literals which represent derived numeric values into * the statement indices.
*
*/ public class DefaultExtensionFactory implements IExtensionFactory { private final List> extensions; public DefaultExtensionFactory() { extensions = new LinkedList>(); } @Override public void init(final IDatatypeURIResolver resolver, final ILexiconConfiguration config) { /* * Always going to inline the derived numeric types. */ extensions.add(new DerivedNumericsExtension(resolver)); /* * Set up the configuration of the geospatial module */ if (config.isGeoSpatial()) { // register the extensions, adding one extension per datatype config final List datatypeConfigs = config.getGeoSpatialConfig().getDatatypeConfigs(); for (int i=0; i( resolver, datatypeConfigs.get(i))); } } if (config.isInlineDateTimes()) { extensions.add(new DateTimeExtension( resolver, config.getInlineDateTimesTimeZone())); } if (config.getMaxInlineStringLength() > 0) { /* * Note: This extension is used for both literals and URIs. It MUST * be enabled when MAX_INLINE_TEXT_LENGTH is GT ZERO (0). Otherwise * we will not be able to inline either the local names or the full * text of URIs. */ extensions.add(new XSDStringExtension(resolver, config .getMaxInlineStringLength())); } _init(resolver, config, extensions); } /** * Give subclasses a chance to add extensions. * * @param resolver * {@link IDatatypeURIResolver} from * {@link #init(IDatatypeURIResolver, ILexiconConfiguration)}. * @param config * The {@link ILexiconConfiguration} from * {@link #init(IDatatypeURIResolver, ILexiconConfiguration)}. * * @param extensions * The extensions that have already been registered. * * @see #init(IDatatypeURIResolver, ILexiconConfiguration) */ protected void _init(final IDatatypeURIResolver resolver, final ILexiconConfiguration config, final Collection> extensions) { // noop } @Override public Iterator> getExtensions() { return Collections.unmodifiableList(extensions).iterator(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy