Class VirtGraph

  • All Implemented Interfaces:
    org.apache.jena.graph.Graph, org.apache.jena.graph.impl.GraphWithPerform
    Direct Known Subclasses:
    VirtDataset, VirtInfGraph

    public class VirtGraph
    extends org.apache.jena.graph.impl.GraphBase
    • Field Detail

      • isXA

        protected boolean isXA
      • graphName

        protected java.lang.String graphName
      • readFromAllGraphs

        protected boolean readFromAllGraphs
      • url_hostlist

        protected java.lang.String url_hostlist
      • user

        protected java.lang.String user
      • password

        protected java.lang.String password
      • roundrobin

        protected boolean roundrobin
      • prefetchSize

        protected int prefetchSize
      • batchSize

        protected int batchSize
      • connection

        protected java.sql.Connection connection
      • ruleSet

        protected java.lang.String ruleSet
      • macroLib

        protected java.lang.String macroLib
      • useSameAs

        protected boolean useSameAs
      • queryTimeout

        protected int queryTimeout
      • useReprepare

        protected boolean useReprepare
      • sparqlPrefix

        protected java.lang.String sparqlPrefix
      • insertBNodeAsVirtuosoIRI

        protected boolean insertBNodeAsVirtuosoIRI
      • resetBNodesDictAfterCall

        protected boolean resetBNodesDictAfterCall
      • resetBNodesDictAfterCommit

        protected boolean resetBNodesDictAfterCommit
      • insertStringLiteralAsSimple

        protected boolean insertStringLiteralAsSimple
      • concurencyMode

        protected int concurencyMode
    • Constructor Detail

      • VirtGraph

        protected VirtGraph​(java.lang.String _graphName,
                            VirtDataset ds)
      • VirtGraph

        public VirtGraph()
      • VirtGraph

        public VirtGraph​(java.lang.String graphName)
      • VirtGraph

        public VirtGraph​(java.lang.String graphName,
                         java.lang.String _url_hostlist,
                         java.lang.String user,
                         java.lang.String password)
      • VirtGraph

        public VirtGraph​(java.lang.String url_hostlist,
                         java.lang.String user,
                         java.lang.String password)
      • VirtGraph

        public VirtGraph​(java.lang.String _graphName,
                         javax.sql.DataSource _ds)
      • VirtGraph

        public VirtGraph​(javax.sql.DataSource _ds)
      • VirtGraph

        public VirtGraph​(java.lang.String _graphName,
                         javax.sql.ConnectionPoolDataSource _ds)
      • VirtGraph

        public VirtGraph​(javax.sql.ConnectionPoolDataSource _ds)
      • VirtGraph

        public VirtGraph​(java.lang.String _graphName,
                         javax.sql.XADataSource _ds)
      • VirtGraph

        public VirtGraph​(javax.sql.XADataSource _ds)
      • VirtGraph

        public VirtGraph​(java.lang.String _graphName,
                         java.lang.String _url_hostlist,
                         java.lang.String user,
                         java.lang.String password,
                         boolean _roundrobin)
    • Method Detail

      • getDataSource

        public javax.sql.DataSource getDataSource()
      • getXAResource

        public javax.transaction.xa.XAResource getXAResource()
      • getGraphName

        public java.lang.String getGraphName()
      • setGraphName

        protected void setGraphName​(java.lang.String name)
      • getGraphUrl

        public java.lang.String getGraphUrl()
      • getGraphUser

        public java.lang.String getGraphUser()
      • getGraphPassword

        public java.lang.String getGraphPassword()
      • getConnection

        public java.sql.Connection getConnection()
      • getFetchSize

        public int getFetchSize()
      • setFetchSize

        public void setFetchSize​(int sz)
      • getQueryTimeout

        public int getQueryTimeout()
      • setQueryTimeout

        public void setQueryTimeout​(int seconds)
      • getBatchSize

        public int getBatchSize()
      • setBatchSize

        public void setBatchSize​(int sz)
      • getSparqlPrefix

        public java.lang.String getSparqlPrefix()
      • setSparqlPrefix

        public void setSparqlPrefix​(java.lang.String val)
      • getInsertBNodeAsVirtuosoIRI

        public boolean getInsertBNodeAsVirtuosoIRI()
        Get the insertBNodeAsURI state for connection
      • setInsertBNodeAsVirtuosoIRI

        public void setInsertBNodeAsVirtuosoIRI​(boolean v)
        Set the insertBNodeAsURI state for connection(default false)
        Parameters:
        v - true - insert BNode as Virtuoso IRI false - insert BNode as Virtuoso Native BNode
      • getResetBNodesDictAfterCall

        public boolean getResetBNodesDictAfterCall()
        Get the resetBNodesDictAfterCall state for connection
      • setResetBNodesDictAfterCall

        public void setResetBNodesDictAfterCall​(boolean v)
        Set the resetBNodesDictAfterCall (reset server side BNodes Dictionary, that is used for map between Jena Bnodes and Virtuoso BNodes, after each add call). The default state for connection is false
        Parameters:
        v - true - reset BNodes Dictionary after each add(add batch) call false - not reset BNode Dictionary after each add(add batch) call
      • getResetBNodesDictAfterCommit

        public boolean getResetBNodesDictAfterCommit()
        Get the resetBNodesDictAfterCommit state for connection
      • setResetBNodesDictAfterCommit

        public void setResetBNodesDictAfterCommit​(boolean v)
        Set the resetBNodesDictAfterCommit (reset server side BNodes Dictionary, that is used for map between Jena Bnodes and Virtuoso BNodes, after commit/rollback). The default state for connection is true
        Parameters:
        v - true - reset BNodes Dictionary after each commit/rollack false - not reset BNode Dictionary after each commit/rollback
      • getInsertStringLiteralAsSimple

        public boolean getInsertStringLiteralAsSimple()
        Get the insertStringLiteralAsSimple state for connection
      • setInsertStringLiteralAsSimple

        public void setInsertStringLiteralAsSimple​(boolean v)
        Set the insertStringLiteralAsSimple state for connection(default false)
        Parameters:
        v - true - insert String Literals as Simple Literals false - insert String Literals as is
      • setConcurrencyMode

        public void setConcurrencyMode​(int mode)
                                throws org.apache.jena.shared.JenaException
        Set the concurrency mode for Insert/Update/Delete operations and SPARUL queries
        Parameters:
        mode - Concurrency mode
        Throws:
        org.apache.jena.shared.JenaException
      • getConcurrencyMode

        public int getConcurrencyMode()
        Get the concurrency mode for Insert/Update/Delete operations and SPARUL queries
        Returns:
        concurrency mode
      • getCount

        public int getCount()
      • remove

        public void remove​(java.util.List triples)
      • remove

        public void remove​(org.apache.jena.graph.Triple t)
      • getReadFromAllGraphs

        public boolean getReadFromAllGraphs()
      • setReadFromAllGraphs

        public void setReadFromAllGraphs​(boolean val)
      • getRuleSet

        public java.lang.String getRuleSet()
      • setRuleSet

        public void setRuleSet​(java.lang.String _ruleSet)
      • getMacroLib

        public java.lang.String getMacroLib()
      • setMacroLib

        public void setMacroLib​(java.lang.String _macroLib)
      • getSameAs

        public boolean getSameAs()
      • setSameAs

        public void setSameAs​(boolean _sameAs)
      • createRuleSet

        public void createRuleSet​(java.lang.String ruleSetName,
                                  java.lang.String uriGraphRuleSet)
      • removeRuleSet

        public void removeRuleSet​(java.lang.String ruleSetName,
                                  java.lang.String uriGraphRuleSet)
      • createStatement

        protected java.sql.Statement createStatement​(boolean isIUD)
                                              throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • prepareStatement

        protected java.sql.PreparedStatement prepareStatement​(java.lang.String sql,
                                                              boolean isIUD)
                                                       throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • appendSparqlPrefixes

        protected void appendSparqlPrefixes​(java.lang.StringBuilder sb,
                                            boolean isSelect)
      • getJdbcConcurrency

        protected int getJdbcConcurrency​(boolean isIUD)
      • Node2Str

        public java.lang.String Node2Str​(org.apache.jena.graph.Node n)
      • Node2Str_add

        public java.lang.String Node2Str_add​(java.lang.Object o)
      • performAdd

        public void performAdd​(org.apache.jena.graph.Triple t)
        Specified by:
        performAdd in interface org.apache.jena.graph.impl.GraphWithPerform
        Overrides:
        performAdd in class org.apache.jena.graph.impl.GraphBase
      • performAdd

        protected void performAdd​(java.lang.String _gName,
                                  org.apache.jena.graph.Triple t)
      • performAdd

        protected void performAdd​(java.lang.String _gName,
                                  org.apache.jena.graph.Node nS,
                                  org.apache.jena.graph.Node nP,
                                  org.apache.jena.graph.Node nO)
      • performDelete

        public void performDelete​(org.apache.jena.graph.Triple t)
        Specified by:
        performDelete in interface org.apache.jena.graph.impl.GraphWithPerform
        Overrides:
        performDelete in class org.apache.jena.graph.impl.GraphBase
      • performDelete

        protected void performDelete​(java.lang.String _gName,
                                     org.apache.jena.graph.Node s,
                                     org.apache.jena.graph.Node p,
                                     org.apache.jena.graph.Node o)
      • graphBaseSize

        protected int graphBaseSize()
        more efficient
        Overrides:
        graphBaseSize in class org.apache.jena.graph.impl.GraphBase
      • graphBaseContains

        protected boolean graphBaseContains​(org.apache.jena.graph.Triple t)
        maybe more efficient than default impl
        Overrides:
        graphBaseContains in class org.apache.jena.graph.impl.GraphBase
      • graphBaseContains

        protected boolean graphBaseContains​(java.lang.String _gName,
                                            org.apache.jena.graph.Triple t)
      • graphBaseFind

        public org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Triple> graphBaseFind​(org.apache.jena.graph.Triple tm)
        Specified by:
        graphBaseFind in class org.apache.jena.graph.impl.GraphBase
      • graphBaseFind

        protected org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Triple> graphBaseFind​(java.lang.String _gName,
                                                                                                             org.apache.jena.graph.Triple tm)
      • close

        public void close()
        Specified by:
        close in interface org.apache.jena.graph.Graph
        Overrides:
        close in class org.apache.jena.graph.impl.GraphBase
      • clear

        public void clear()
        Specified by:
        clear in interface org.apache.jena.graph.Graph
        Overrides:
        clear in class org.apache.jena.graph.impl.GraphBase
      • clear

        public void clear​(org.apache.jena.graph.Node... graphs)
      • read

        public void read​(java.lang.String url,
                         java.lang.String type)
      • createBNodesDict

        protected void createBNodesDict()
      • dropBNodesDict

        protected void dropBNodesDict()
      • startBatchAdd

        protected void startBatchAdd()
      • stopBatchAdd

        protected void stopBatchAdd()
      • add

        protected void add​(java.lang.String _gName,
                           java.util.Iterator<org.apache.jena.rdf.model.Statement> it)
      • delete

        protected void delete​(java.lang.String _gName,
                              java.util.Iterator<org.apache.jena.rdf.model.Statement> it)
      • md_delete_Model

        protected void md_delete_Model​(org.apache.jena.rdf.model.StmtIterator it)
      • bindBatchParams

        protected void bindBatchParams​(java.sql.PreparedStatement ps,
                                       org.apache.jena.graph.Node subject,
                                       org.apache.jena.graph.Node predicate,
                                       org.apache.jena.graph.Node object,
                                       java.lang.String _graphName)
                                throws java.sql.SQLException
        0 - The o is a string representing a URI. o_type is ignored. 1 - The string is an RDF literal string without type or language tag. o_type is ignored. 2 - The o is a literal string and o_type is its language tag. 3 - The o is a literall string and the o_type is an RDF type URI for the literal. 4 - The o is a well formed XML string to be stored as XML. o_type is ignored. 5 - The o is a string representation of an integer. o_type is ignored. 6 - The o is a string representation of a float. o_type is ignored. 7 - The o is a string representation of a double. o_type is ignored. 8 - The o is a string representation of a decimal. o_type is ignored.
        Throws:
        java.sql.SQLException
      • reifierTriples

        public org.apache.jena.util.iterator.ExtendedIterator reifierTriples​(org.apache.jena.graph.Triple m)
      • reifierSize

        public int reifierSize()
      • getTransactionHandler

        public VirtTransactionHandler getTransactionHandler()
        Specified by:
        getTransactionHandler in interface org.apache.jena.graph.Graph
        Overrides:
        getTransactionHandler in class org.apache.jena.graph.impl.GraphBase
      • getPrefixMapping

        public org.apache.jena.shared.PrefixMapping getPrefixMapping()
        Specified by:
        getPrefixMapping in interface org.apache.jena.graph.Graph
        Overrides:
        getPrefixMapping in class org.apache.jena.graph.impl.GraphBase
      • Object2Node

        public static org.apache.jena.graph.Node Object2Node​(java.lang.Object o)