// Path: src/main/java/com/blazegraph/gremlin/internal/ListIndexExtension.java
// @SuppressWarnings("rawtypes")
// public class ListIndexExtension<V extends BigdataValue> implements IExtension<V> {
// 
//     private final BigdataURI datatype;
//     
//     public static final URI DATATYPE = 
//         new URIImpl("http://www.blazegraph.com/rdf/datatype#listIndex");
// 
//     
//     public ListIndexExtension(final IDatatypeURIResolver resolver) {
//         datatype = resolver.resolve(DATATYPE);
//     }
//     
//     public Set<BigdataURI> getDatatypes() {
//         return Collections.singleton(datatype);
//     }
//     
//     /**
//      * Convert the supplied value into an internal representation as
//      * PackedLongIV.
//      */
//     @SuppressWarnings("unchecked")
//     public LiteralExtensionIV createIV(final Value value) {
// 
//         if (value instanceof Literal == false)
//             throw new IllegalArgumentException();
// 
//         final Literal lit = (Literal) value;
// 
//         final AbstractLiteralIV delegate = 
//                 new PackedLongIV(Long.parseLong(lit.getLabel()));
//         return new LiteralExtensionIV(delegate, datatype.getIV());
// 
//     }
// 
//     @SuppressWarnings("unchecked")
//     public V asValue(final LiteralExtensionIV iv, final BigdataValueFactory vf) {
// 
//         AbstractLiteralIV delegate = iv.getDelegate();
//         if (delegate == null || !(delegate instanceof PackedLongIV)) {
//             throw new IllegalArgumentException();
//         }
// 
//         final PackedLongIV pIv = (PackedLongIV) delegate;
//         return (V) vf.createLiteral(
//                 String.valueOf(pIv.getInlineValue()), DATATYPE);
// 
//     }
// 
// }


import com.bigdata.rdf.sail.RDRHistory;
import com.blazegraph.gremlin.internal.ListIndexExtension;
import org.openrdf.model.Literal;
import org.openrdf.model.URI;
import org.openrdf.model.ValueFactory;
import org.openrdf.model.impl.URIImpl;
import org.openrdf.model.impl.ValueFactoryImpl;
import org.openrdf.model.vocabulary.RDF;
import com.bigdata.rdf.internal.XSD;
/**
Copyright (C) SYSTAP, LLC DBA Blazegraph 2006-2016.  All rights reserved.

Contact:
     SYSTAP, LLC DBA Blazegraph
     2501 Calvert ST NW #106
     Washington, DC 20008
     licenses@blazegraph.com

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
package com.blazegraph.gremlin.structure;



/**
 * Factory for converting Tinkerpop data (element ids, property names/values)
 * to RDF values (URIs, Literals) and back again.  This interface comes with
 * reasonable default behavior for all methods.  It can be overridden to give
 * an application a custom look and feel for the RDF values used to represent
 * the property graph.
 * 
 * @author mikepersonick
 */
public interface BlazeValueFactory {

    /**
     * Default instance.
     */
    public static final BlazeValueFactory INSTANCE = new BlazeValueFactory() {};

    /**
     * Some default constants.
     * 
     * @author mikepersonick
     */
    public interface Defaults {
        
        /**
         * Namespace for RDF URIs.
         */
        String NAMESPACE = "blaze:";
        
        /**
         * URI used for typing elements.
         */
        URI TYPE = RDF.TYPE;
        
        /**
         * URI used for list item values.
         */
        URI VALUE = RDF.VALUE;
        
        /**
         * Datatype URI for list index for Cardinality.list vertex properties. 
         */
// Path: src/main/java/com/blazegraph/gremlin/internal/ListIndexExtension.java
// @SuppressWarnings("rawtypes")
// public class ListIndexExtension<V extends BigdataValue> implements IExtension<V> {
// 
//     private final BigdataURI datatype;
//     
//     public static final URI DATATYPE = 
//         new URIImpl("http://www.blazegraph.com/rdf/datatype#listIndex");
// 
//     
//     public ListIndexExtension(final IDatatypeURIResolver resolver) {
//         datatype = resolver.resolve(DATATYPE);
//     }
//     
//     public Set<BigdataURI> getDatatypes() {
//         return Collections.singleton(datatype);
//     }
//     
//     /**
//      * Convert the supplied value into an internal representation as
//      * PackedLongIV.
//      */
//     @SuppressWarnings("unchecked")
//     public LiteralExtensionIV createIV(final Value value) {
// 
//         if (value instanceof Literal == false)
//             throw new IllegalArgumentException();
// 
//         final Literal lit = (Literal) value;
// 
//         final AbstractLiteralIV delegate = 
//                 new PackedLongIV(Long.parseLong(lit.getLabel()));
//         return new LiteralExtensionIV(delegate, datatype.getIV());
// 
//     }
// 
//     @SuppressWarnings("unchecked")
//     public V asValue(final LiteralExtensionIV iv, final BigdataValueFactory vf) {
// 
//         AbstractLiteralIV delegate = iv.getDelegate();
//         if (delegate == null || !(delegate instanceof PackedLongIV)) {
//             throw new IllegalArgumentException();
//         }
// 
//         final PackedLongIV pIv = (PackedLongIV) delegate;
//         return (V) vf.createLiteral(
//                 String.valueOf(pIv.getInlineValue()), DATATYPE);
// 
//     }
// 
// }


// Path: src/main/java/com/blazegraph/gremlin/structure/BlazeValueFactory.java
import com.bigdata.rdf.sail.RDRHistory;
import com.blazegraph.gremlin.internal.ListIndexExtension;
import org.openrdf.model.Literal;
import org.openrdf.model.URI;
import org.openrdf.model.ValueFactory;
import org.openrdf.model.impl.URIImpl;
import org.openrdf.model.impl.ValueFactoryImpl;
import org.openrdf.model.vocabulary.RDF;
import com.bigdata.rdf.internal.XSD;

/**
Copyright (C) SYSTAP, LLC DBA Blazegraph 2006-2016.  All rights reserved.

Contact:
     SYSTAP, LLC DBA Blazegraph
     2501 Calvert ST NW #106
     Washington, DC 20008
     licenses@blazegraph.com

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
package com.blazegraph.gremlin.structure;



/**
 * Factory for converting Tinkerpop data (element ids, property names/values)
 * to RDF values (URIs, Literals) and back again.  This interface comes with
 * reasonable default behavior for all methods.  It can be overridden to give
 * an application a custom look and feel for the RDF values used to represent
 * the property graph.
 * 
 * @author mikepersonick
 */
public interface BlazeValueFactory {

    /**
     * Default instance.
     */
    public static final BlazeValueFactory INSTANCE = new BlazeValueFactory() {};

    /**
     * Some default constants.
     * 
     * @author mikepersonick
     */
    public interface Defaults {
        
        /**
         * Namespace for RDF URIs.
         */
        String NAMESPACE = "blaze:";
        
        /**
         * URI used for typing elements.
         */
        URI TYPE = RDF.TYPE;
        
        /**
         * URI used for list item values.
         */
        URI VALUE = RDF.VALUE;
        
        /**
         * Datatype URI for list index for Cardinality.list vertex properties. 
         */
        URI LI_DATATYPE = ListIndexExtension.DATATYPE;