idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
132,900 | static void constructTotalHitsGraph ( Map . Entry < String , LrProjectScenarioResults > scenarioResults , JSONObject scenarioGraphData ) { Map < Integer , WholeRunResult > totalHitsResults = scenarioResults . getValue ( ) . getTotalHitsResults ( ) ; JSONObject totalHitsGraphSet = extractWholeRunSlaResult ( totalHitsRes... | Construct total hits graph . |
132,901 | private static String digestToString ( byte [ ] b ) { StringBuilder result = new StringBuilder ( 128 ) ; for ( byte aB : b ) { result . append ( Integer . toString ( ( aB & 0xff ) + 0x100 , 16 ) . substring ( 1 ) ) ; } return result . toString ( ) ; } | This method convert byte array to string regardless the charset |
132,902 | public JSONArray getScenarioList ( ) { JSONArray scenarioList = new JSONArray ( ) ; for ( String scenarioName : _projectResult . getScenarioResults ( ) . keySet ( ) ) { JSONObject scenario = new JSONObject ( ) ; scenario . put ( "ScenarioName" , scenarioName ) ; scenarioList . add ( scenario ) ; } return scenarioList ;... | Gets scenario list . |
132,903 | public JSONObject getGraphData ( ) { JSONObject projectDataSet = new JSONObject ( ) ; if ( _projectResult == null ) { return new JSONObject ( ) ; } for ( SortedMap . Entry < String , LrProjectScenarioResults > scenarioResults : _projectResult . getScenarioResults ( ) . entrySet ( ) ) { JSONObject scenarioData = new JSO... | Collates graph data per scenario per build for the whole project . Adds the respected graphs with scenario as the key |
132,904 | boolean isVisible ( ) { List < ? extends Run < ? , ? > > builds = currentProject . getBuilds ( ) ; for ( Run run : builds ) { if ( run . getAction ( PerformanceJobReportAction . class ) != null ) { return true ; } } return false ; } | Is visible boolean . |
132,905 | public synchronized void getUpdatedData ( ) { if ( ! isUpdateDataNeeded ( ) ) { return ; } this . _projectResult = new ProjectLrResults ( ) ; _workedBuilds = new ArrayList < Integer > ( ) ; RunList < ? extends Run > projectBuilds = currentProject . getBuilds ( ) ; for ( Run run : projectBuilds ) { PerformanceJobReportA... | Gets updated data . |
132,906 | public JSONObject getJobDetails ( String mcUrl , String proxyAddress , String proxyUserName , String proxyPassword ) { if ( StringUtils . isBlank ( fsUserName ) || StringUtils . isBlank ( fsPassword . getPlainText ( ) ) ) { return null ; } return JobConfigurationProxy . getInstance ( ) . getJobById ( mcUrl , fsUserName... | Get proxy details json object . |
132,907 | public SWNativeAlignerResult align ( byte [ ] refArray , byte [ ] altArray , SWParameters parameters , SWOverhangStrategy overhangStrategy ) { int intStrategy = getStrategy ( overhangStrategy ) ; byte [ ] cigar = new byte [ 2 * Integer . max ( refArray . length , altArray . length ) ] ; int offset = alignNative ( refAr... | Implements the native implementation of SmithWaterman and returns the Cigar String and alignment_offset |
132,908 | public Deflater makeDeflater ( final int compressionLevel , final boolean gzipCompatible ) { if ( intelDeflaterSupported ) { if ( ( compressionLevel == 1 && gzipCompatible ) || compressionLevel != 1 ) { return new IntelDeflater ( compressionLevel , gzipCompatible ) ; } } logger . warn ( "IntelDeflater is not supported,... | Returns an IntelDeflater if supported on the platform otherwise returns a Java Deflater |
132,909 | public void initialize ( PairHMMNativeArguments args ) { if ( args == null ) { args = new PairHMMNativeArguments ( ) ; args . useDoublePrecision = false ; args . maxNumberOfThreads = 1 ; } if ( ! useFpga && gklUtils . isAvx512Supported ( ) ) { logger . info ( "Using CPU-supported AVX-512 instructions" ) ; } if ( args .... | Initialize native PairHMM with the supplied args . |
132,910 | public void execute ( ) { if ( "pom" . equals ( project . getPackaging ( ) ) ) { return ; } File managedPath = new File ( project . getBuild ( ) . getDirectory ( ) , "src_managed" ) ; String managedPathStr = managedPath . getAbsolutePath ( ) ; if ( ! project . getCompileSourceRoots ( ) . contains ( managedPathStr ) ) {... | Adds default SBT managed sources location to Maven project . |
132,911 | public void execute ( ) { if ( "pom" . equals ( project . getPackaging ( ) ) ) { return ; } File baseDir = project . getBasedir ( ) ; File mainScalaPath = new File ( baseDir , "src/main/scala" ) ; if ( mainScalaPath . isDirectory ( ) ) { String mainScalaPathStr = mainScalaPath . getAbsolutePath ( ) ; if ( ! project . g... | Adds default Scala sources locations to Maven project . |
132,912 | public static File getCacheDirectory ( File classesDirectory ) { String classesDirectoryName = classesDirectory . getName ( ) ; String cacheDirectoryName = classesDirectoryName . replace ( TEST_CLASSES , CACHE ) . replace ( CLASSES , CACHE ) ; return new File ( classesDirectory . getParentFile ( ) , cacheDirectoryName ... | Returns directory for incremental compilation cache files . |
132,913 | private CompilationProblem [ ] getScalacProblems ( Problem [ ] problems ) { CompilationProblem [ ] result = new CompilationProblem [ problems . length ] ; for ( int i = 0 ; i < problems . length ; i ++ ) { Problem problem = problems [ i ] ; Position position = problem . position ( ) ; Maybe < Integer > line = position ... | scalac problems conversion |
132,914 | private static void submitScalaProgram ( QdsClient client ) throws Exception { String sampleProgram = "println(\"hello world\")" ; SparkCommandBuilder sparkBuilder = client . command ( ) . spark ( ) ; sparkBuilder . name ( "spark-scala-test" ) ; sparkBuilder . program ( sampleProgram ) ; sparkBuilder . language ( "scal... | An Example of submitting Spark Command as a Scala program . Similarly we can submit Spark Command as a SQL query R program and Java program . |
132,915 | private static void submitSQLQuery ( QdsClient client ) throws Exception { String sampleSqlQuery = "select * from default_qubole_airline_origin_destination limit 100" ; SparkCommandBuilder sparkBuilder = client . command ( ) . spark ( ) ; sparkBuilder . name ( "spark-sql-test" ) ; sparkBuilder . sql ( sampleSqlQuery ) ... | An example of submitting Spark Command as a SQL query . |
132,916 | private void secondWalk ( TreeNode v , double m , int level , double levelStart ) { double levelChangeSign = getLevelChangeSign ( ) ; boolean levelChangeOnYAxis = isLevelChangeInYAxis ( ) ; double levelSize = getSizeOfLevel ( level ) ; double x = getPrelim ( v ) + m ; double y ; AlignmentInLevel alignment = configurati... | In difference to the original algorithm we also pass in extra level information . |
132,917 | public void dumpTree ( PrintStream printStream , DumpConfiguration dumpConfiguration ) { dumpTree ( printStream , tree . getRoot ( ) , 0 , dumpConfiguration ) ; } | Prints a dump of the tree to the given printStream using the node s toString method . |
132,918 | public static void main ( String [ ] args ) throws IOException { String s = doc ( svg ( 160 , 200 , rect ( 0 , 0 , 160 , 200 , "fill:red;" ) + svg ( 10 , 10 , 100 , 100 , rect ( 0 , 0 , 100 , 100 , "fill:orange; stroke:rgb(0,0,0);" ) ) + line ( 20 , 20 , 100 , 100 , "stroke:black; stroke-width:2px;" ) + line ( 20 , 100... | Creates a sample SVG file demo . svg |
132,919 | public Reader getResults ( ResultValue resultValue ) throws Exception { if ( resultValue . isInline ( ) ) { return new StringReader ( resultValue . getResults ( ) ) ; } return readFromS3 ( resultValue . getResult_location ( ) ) ; } | Return a stream over the given results . If the results are not inline the results will come from S3 |
132,920 | private boolean checkCommandTypeSupported ( BaseCommand command ) { if ( ( command . getCommandType ( ) == BaseCommand . COMMAND_TYPE . NONE ) || ( command . getCommandType ( ) == BaseCommand . COMMAND_TYPE . COMPOSITE ) ) { return false ; } return true ; } | workflow or not |
132,921 | public static String quote ( String s , String nullResult ) { if ( s == null ) { return nullResult ; } StringBuffer result = new StringBuffer ( ) ; result . append ( '"' ) ; int length = s . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { char c = s . charAt ( i ) ; switch ( c ) { case '\b' : { result . append ( "... | Returns a quoted version of a given string i . e . as a Java String Literal . |
132,922 | public static Document parse ( JsonReader reader ) throws IOException , NotImplemented { reader . beginArray ( ) ; int nodeType = reader . nextInt ( ) ; CoreDocumentImpl doc = new DocumentImpl ( ) ; if ( nodeType == Node . ELEMENT_NODE ) { addInitialElement ( reader , doc ) ; } else if ( nodeType == Node . DOCUMENT_NOD... | First element must be a document node or element node |
132,923 | public Document toXml ( InputStream json ) throws IOException , NotImplemented { JsonReader reader = null ; try { reader = new JsonReader ( new InputStreamReader ( json , "utf-8" ) ) ; return parse ( reader ) ; } catch ( UnsupportedEncodingException e ) { throw new IllegalStateException ( e ) ; } finally { if ( reader ... | First element must be a document |
132,924 | public CombinedStatus getCombinedStatus ( String owner , String repository , String ref ) { Map < String , Object > uriVariables = new HashMap < > ( ) ; uriVariables . put ( "owner" , owner ) ; uriVariables . put ( "repository" , repository ) ; uriVariables . put ( "ref" , ref ) ; return getRestOperations ( ) . exchang... | ref can be SHA branch or tag . |
132,925 | public void waitForLogMessage ( final String logSearchString , int waitTime ) throws TimeoutException { WaitForContainer . waitForCondition ( new LogChecker ( this , logSearchString ) , waitTime , describe ( ) ) ; } | Stop and wait till given string will show in container output . |
132,926 | public void waitForExit ( ) throws InterruptedException { try { dockerClient . waitContainer ( container . id ( ) ) ; } catch ( DockerException e ) { throw new IllegalStateException ( e ) ; } } | Block until container exit . |
132,927 | public String getLog ( ) { try ( LogStream stream = dockerClient . logs ( container . id ( ) , LogsParam . stdout ( ) , LogsParam . stderr ( ) ) ; ) { String fullLog = stream . readFully ( ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( "{} full log: {}" , containerShortId , StringUtils . replace ( fullLog , "\n" ,... | Container log . |
132,928 | public DockerRuleBuilder keepContainer ( boolean keepContainer ) { if ( keepContainer ) { this . stopOptions . setOptions ( StopOption . KEEP ) ; } else { this . stopOptions . setOptions ( StopOption . REMOVE ) ; } return this ; } | Keep stopped container after test . |
132,929 | public DockerRuleBuilder env ( String envName , String envValue ) { env . add ( String . format ( "%s=%s" , envName , envValue ) ) ; return this ; } | Set environment variable in the container . |
132,930 | static void waitForCondition ( final StartConditionCheck condition , int timeoutSeconds , final String containerDescription ) throws TimeoutException { try { log . info ( "wait for {} started" , condition . describe ( ) ) ; new WaitForUnit ( TimeUnit . SECONDS , timeoutSeconds , TimeUnit . SECONDS , 1 , new WaitForUnit... | Wait till all given conditions are met . |
132,931 | public void update ( Client client ) { RestfulUtils . update ( ClientService . PATH , client , Client . class , super . httpClient ) ; } | This function updates the data of a client . To change only a specific attribute you can set this attribute in the update request . All other attributes that should not be edited are not inserted . You can only edit the description email and credit card . The subscription can not be changed by updating the client data ... |
132,932 | public void delete ( Client client ) { RestfulUtils . delete ( ClientService . PATH , client , Client . class , super . httpClient ) ; } | This function deletes a client but its transactions are not deleted . |
132,933 | public void delete ( final Preauthorization preauthorization ) { RestfulUtils . delete ( PreauthorizationService . PATH , preauthorization , Preauthorization . class , super . httpClient ) ; } | This function deletes a preauthorization . |
132,934 | public void delete ( Offer offer , boolean removeWithSubscriptions ) { ParameterMap < String , String > params = new ParameterMap < String , String > ( ) ; params . add ( "remove_with_subscriptions" , String . valueOf ( removeWithSubscriptions ) ) ; RestfulUtils . delete ( OfferService . PATH , offer , params , Offer .... | Remove an offer . |
132,935 | public < O extends Schema > O setId ( String schemaId ) { getJson ( ) . put ( "id" , schemaId ) ; return ( O ) this ; } | Should be URI |
132,936 | public static Matcher < JsonElement > withCharsLessOrEqualTo ( final int value ) { return new TypeSafeDiagnosingMatcher < JsonElement > ( ) { protected boolean matchesSafely ( JsonElement item , Description mismatchDescription ) { if ( ! item . isString ( ) ) return true ; if ( item . asString ( ) . length ( ) > value ... | == > STRING == > |
132,937 | public static Matcher < JsonElement > isOfType ( final String type ) { return new TypeSafeDiagnosingMatcher < JsonElement > ( ) { protected boolean matchesSafely ( JsonElement item , Description mismatchDescription ) { if ( type . equals ( item . getJsonType ( ) ) ) return true ; else { mismatchDescription . appendText... | == > COMMON == > |
132,938 | public static Matcher < JsonElement > areItemsValid ( final Validator validator ) { return new TypeSafeDiagnosingMatcher < JsonElement > ( ) { protected boolean matchesSafely ( JsonElement item , Description mismatchDescription ) { if ( ! item . isJsonArray ( ) ) return true ; for ( int i = 0 ; i < item . asJsonArray (... | == > ARRAY == > |
132,939 | public static Matcher < JsonElement > maxProperties ( final int maxProperties ) { return new TypeSafeDiagnosingMatcher < JsonElement > ( ) { protected boolean matchesSafely ( JsonElement item , Description mismatchDescription ) { if ( ! item . isJsonObject ( ) ) return true ; if ( item . asJsonObject ( ) . length ( ) >... | == > OBJECT == > |
132,940 | public static JsonElement wrap ( Object o ) throws JsonException { if ( o == null ) { return null ; } if ( o instanceof JsonElement ) { return ( JsonElement ) o ; } if ( o instanceof ElementWrapper ) { return ( ( ElementWrapper ) o ) . getJson ( ) ; } if ( o instanceof Collection ) { return new JsonArray ( ( Collection... | Wraps the given object if to JsonXXX object . |
132,941 | public Schema fetch ( URI targetUri , URI srcOrigUri , URI srcId ) { Schema res = null ; URI schemaUri = convertUri ( resolveUri ( targetUri , srcOrigUri , srcId ) ) ; if ( ! schemaUri . isAbsolute ( ) ) throw new RuntimeException ( "Json Schema Fetcher works only with absolute URIs" ) ; try { String fragment = schemaU... | accepts only absolute URI or converted absolute URI |
132,942 | private MetaInfo tryFetchMetaInfo ( URI jsonSchemaUri ) { if ( jsonSchemaUri == null ) return null ; try { metaInfo = doFetchMetaInfo ( jsonSchemaUri ) ; Validator validator = metaInfo . getDefaultValidator ( ) ; if ( validator != null ) { getValidators ( ) . add ( validator ) ; } } catch ( Exception ex ) { return null... | Tries to fetch a schema and add the default Schema validator for it |
132,943 | public static String numberToString ( Number number ) throws JsonException { if ( number == null ) { throw new JsonException ( "Number must be non-null" ) ; } double doubleValue = number . doubleValue ( ) ; if ( number . equals ( NEGATIVE_ZERO ) ) { return "-0" ; } long longValue = number . longValue ( ) ; if ( doubleV... | Encodes the number as a Json string . |
132,944 | public JsonObject merge ( JsonObject another ) { for ( Map . Entry < String , JsonElement > anotherEntry : another ) { JsonElement curr = this . opt ( anotherEntry . getKey ( ) ) ; if ( curr == null ) { try { this . put ( anotherEntry . getKey ( ) , anotherEntry . getValue ( ) ) ; } catch ( JsonException e ) { e . prin... | Merge Json Object with another Json Object . It does not change element of another with the same name exists . However if the element is Json Object then it will go down and merge that object . |
132,945 | public void sync ( ) throws MarkLogicSesameException { if ( WRITE_CACHE_ENABLED && timerWriteCache != null ) timerWriteCache . forceRun ( ) ; if ( DELETE_CACHE_ENABLED && timerDeleteCache != null ) timerDeleteCache . forceRun ( ) ; } | forces write cache to flush triples |
132,946 | public void sendAdd ( File file , String baseURI , RDFFormat dataFormat , Resource ... contexts ) throws RDFParseException { getClient ( ) . performAdd ( file , baseURI , dataFormat , this . tx , contexts ) ; } | add triples from file |
132,947 | public void sendAdd ( InputStream in , String baseURI , RDFFormat dataFormat , Resource ... contexts ) throws RDFParseException , MarkLogicSesameException { getClient ( ) . performAdd ( in , baseURI , dataFormat , this . tx , contexts ) ; } | add triples from InputStream |
132,948 | public void sendAdd ( String baseURI , Resource subject , URI predicate , Value object , Resource ... contexts ) throws MarkLogicSesameException { if ( WRITE_CACHE_ENABLED ) { timerWriteCache . add ( subject , predicate , object , contexts ) ; } else { getClient ( ) . performAdd ( baseURI , ( Resource ) skolemize ( sub... | add single triple if cache is enabled will add triple to cache model |
132,949 | public void sendRemove ( String baseURI , Resource subject , URI predicate , Value object , Resource ... contexts ) throws MarkLogicSesameException { if ( DELETE_CACHE_ENABLED ) { timerDeleteCache . add ( subject , predicate , object , contexts ) ; } else { if ( WRITE_CACHE_ENABLED ) sync ( ) ; getClient ( ) . performR... | remove single triple |
132,950 | public void commitTransaction ( ) throws MarkLogicTransactionException { if ( isActiveTransaction ( ) ) { try { sync ( ) ; this . tx . commit ( ) ; this . tx = null ; } catch ( MarkLogicSesameException e ) { logger . error ( e . getLocalizedMessage ( ) ) ; throw new MarkLogicTransactionException ( e ) ; } } else { thro... | commits a transaction |
132,951 | public void setGraphPerms ( GraphPermissions graphPerms ) { if ( graphPerms != null ) { getClient ( ) . setGraphPerms ( graphPerms ) ; } else { getClient ( ) . setGraphPerms ( getClient ( ) . getDatabaseClient ( ) . newGraphManager ( ) . newGraphPermissions ( ) ) ; } } | setter for GraphPermissions |
132,952 | public synchronized MarkLogicClient getMarkLogicClient ( ) { if ( null != databaseClient ) { this . client = new MarkLogicClient ( databaseClient ) ; } else { this . client = new MarkLogicClient ( host , port , user , password , auth ) ; } return this . client ; } | returns MarkLogicClient object which manages communication to ML server via Java api client |
132,953 | private void setDatabaseClient ( DatabaseClient databaseClient ) { this . databaseClient = databaseClient ; this . sparqlManager = getDatabaseClient ( ) . newSPARQLQueryManager ( ) ; this . graphManager = getDatabaseClient ( ) . newGraphManager ( ) ; } | set databaseclient and instantate related managers |
132,954 | public void performAdd ( File file , String baseURI , RDFFormat dataFormat , Transaction tx , Resource ... contexts ) throws RDFParseException { try { graphManager . setDefaultMimetype ( dataFormat . getDefaultMIMEType ( ) ) ; if ( dataFormat . equals ( RDFFormat . NQUADS ) || dataFormat . equals ( RDFFormat . TRIG ) )... | as we use mergeGraphs baseURI is always file . toURI |
132,955 | public void performAdd ( InputStream in , String baseURI , RDFFormat dataFormat , Transaction tx , Resource ... contexts ) throws RDFParseException , MarkLogicSesameException { try { graphManager . setDefaultMimetype ( dataFormat . getDefaultMIMEType ( ) ) ; if ( dataFormat . equals ( RDFFormat . NQUADS ) || dataFormat... | executes merge of triples from InputStream |
132,956 | public void performAdd ( String baseURI , Resource subject , URI predicate , Value object , Transaction tx , Resource ... contexts ) throws MarkLogicSesameException { StringBuilder sb = new StringBuilder ( ) ; if ( notNull ( contexts ) && contexts . length > 0 ) { if ( notNull ( baseURI ) ) sb . append ( "BASE <" + bas... | executes INSERT of single triple |
132,957 | public void performClear ( Transaction tx , Resource ... contexts ) { if ( notNull ( contexts ) ) { for ( int i = 0 ; i < contexts . length ; i ++ ) { if ( notNull ( contexts [ i ] ) ) { graphManager . delete ( contexts [ i ] . stringValue ( ) , tx ) ; } else { graphManager . delete ( DEFAULT_GRAPH_URI , tx ) ; } } } e... | clears triples from named graph |
132,958 | public void setRulesets ( SPARQLRuleset ... rulesets ) { if ( notNull ( rulesets ) ) { List < SPARQLRuleset > list = new ArrayList < > ( ) ; for ( Object r : rulesets ) { if ( r != null && rulesets . length > 0 ) { list . add ( ( SPARQLRuleset ) r ) ; } } this . ruleset = list . toArray ( new SPARQLRuleset [ list . siz... | setter for rulesets filters out nulls |
132,959 | protected SPARQLBindings getSPARQLBindings ( SPARQLQueryBindingSet bindings ) { SPARQLBindings sps = new SPARQLBindingsImpl ( ) ; for ( Binding binding : bindings ) { sps . bind ( binding . getName ( ) , binding . getValue ( ) . stringValue ( ) ) ; } return sps ; } | converts Sesame BindingSet to java api client SPARQLBindings |
132,960 | public synchronized void run ( ) { Date now = new Date ( ) ; if ( ! cache . isEmpty ( ) && ( ( cache . size ( ) > cacheSize - 1 ) || ( now . getTime ( ) - lastCacheAccess . getTime ( ) > cacheMillis ) ) ) { try { flush ( ) ; } catch ( RepositoryException e ) { log . error ( e . getLocalizedMessage ( ) ) ; throw new Run... | tests to see if we should flush cache |
132,961 | public synchronized void forceRun ( ) throws MarkLogicSesameException { log . debug ( String . valueOf ( cache . size ( ) ) ) ; if ( ! cache . isEmpty ( ) ) { try { flush ( ) ; } catch ( RepositoryException e ) { throw new MarkLogicSesameException ( "Could not flush write cache, encountered repository issue." , e ) ; }... | min forces the cache to flush if there is anything in it |
132,962 | public synchronized void add ( Resource subject , URI predicate , Value object , Resource ... contexts ) throws MarkLogicSesameException { cache . add ( subject , predicate , object , contexts ) ; if ( cache . size ( ) > cacheSize - 1 ) { forceRun ( ) ; } } | add triple to cache Model |
132,963 | public Query prepareQuery ( String queryString , String baseURI ) throws RepositoryException , MalformedQueryException { return prepareQuery ( QueryLanguage . SPARQL , queryString , baseURI ) ; } | overload for prepareQuery |
132,964 | public MarkLogicQuery prepareQuery ( QueryLanguage queryLanguage , String queryString , String baseURI ) throws RepositoryException , MalformedQueryException { if ( SPARQL . equals ( queryLanguage ) ) { String queryStringWithoutProlog = QueryParserUtil . removeSPARQLQueryProlog ( queryString ) . toUpperCase ( ) ; if ( ... | base method for prepareQuery |
132,965 | public MarkLogicGraphQuery prepareGraphQuery ( String queryString , String baseURI ) throws RepositoryException , MalformedQueryException { return prepareGraphQuery ( QueryLanguage . SPARQL , queryString , baseURI ) ; } | overload for prepareGraphQuery |
132,966 | public MarkLogicBooleanQuery prepareBooleanQuery ( String queryString ) throws RepositoryException , MalformedQueryException { return prepareBooleanQuery ( QueryLanguage . SPARQL , queryString , null ) ; } | overload for prepareBooleanQuery |
132,967 | public MarkLogicUpdateQuery prepareUpdate ( String queryString , String baseURI ) throws RepositoryException , MalformedQueryException { return prepareUpdate ( QueryLanguage . SPARQL , queryString , baseURI ) ; } | overload for prepareUpdate |
132,968 | public MarkLogicUpdateQuery prepareUpdate ( QueryLanguage queryLanguage , String queryString , String baseURI ) throws RepositoryException , MalformedQueryException { if ( QueryLanguage . SPARQL . equals ( queryLanguage ) ) { return new MarkLogicUpdateQuery ( this . client , new SPARQLQueryBindingSet ( ) , baseURI , qu... | base method for prepareUpdate |
132,969 | public RepositoryResult < Resource > getContextIDs ( ) throws RepositoryException { try { TupleQuery tupleQuery = prepareTupleQuery ( QueryLanguage . SPARQL , ALL_GRAPH_URIS ) ; TupleQueryResult result = tupleQuery . evaluate ( ) ; return new RepositoryResult < Resource > ( new ExceptionConvertingIteration < Resource ,... | returns list of graph names as Resource |
132,970 | public RepositoryResult < Statement > getStatements ( Resource subj , URI pred , Value obj , boolean includeInferred ) throws RepositoryException { try { if ( isQuadMode ( ) ) { TupleQuery tupleQuery = prepareTupleQuery ( GET_STATEMENTS ) ; setBindings ( tupleQuery , subj , pred , obj ) ; tupleQuery . setIncludeInferre... | returns all statements |
132,971 | public RepositoryResult < Statement > getStatements ( Resource subj , URI pred , Value obj , boolean includeInferred , Resource ... contexts ) throws RepositoryException { if ( contexts == null ) { contexts = new Resource [ ] { null } ; } try { if ( isQuadMode ( ) ) { StringBuilder sb = new StringBuilder ( ) ; sb . app... | returns statements from supplied context |
132,972 | public long size ( ) throws RepositoryException { try { MarkLogicTupleQuery tupleQuery = prepareTupleQuery ( COUNT_EVERYTHING ) ; tupleQuery . setIncludeInferred ( false ) ; tupleQuery . setRulesets ( ( SPARQLRuleset ) null ) ; tupleQuery . setConstrainingQueryDefinition ( ( QueryDefinition ) null ) ; TupleQueryResult ... | returns number of triples in the entire triple store |
132,973 | public long size ( Resource ... contexts ) throws RepositoryException { if ( contexts == null ) { contexts = new Resource [ ] { null } ; } try { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "SELECT (count(?s) as ?ct) where { GRAPH ?g { ?s ?p ?o }" ) ; boolean first = true ; if ( contexts != null && contexts... | returns number of triples in supplied context |
132,974 | public void add ( InputStream in , String baseURI , RDFFormat dataFormat , Resource ... contexts ) throws IOException , RDFParseException , RepositoryException { getClient ( ) . sendAdd ( in , baseURI , dataFormat , contexts ) ; } | add triples via inputstream |
132,975 | public void add ( File file , String baseURI , RDFFormat dataFormat , Resource ... contexts ) throws IOException , RDFParseException , RepositoryException { if ( notNull ( baseURI ) ) { getClient ( ) . sendAdd ( file , baseURI , dataFormat , contexts ) ; } else { getClient ( ) . sendAdd ( file , file . toURI ( ) . toSt... | add triples via File |
132,976 | public void add ( Reader reader , String baseURI , RDFFormat dataFormat , Resource ... contexts ) throws IOException , RDFParseException , RepositoryException { getClient ( ) . sendAdd ( reader , baseURI , dataFormat , contexts ) ; } | add triples via Reader |
132,977 | public void add ( URL url , String baseURI , RDFFormat dataFormat , Resource ... contexts ) throws IOException , RDFParseException , RepositoryException { if ( notNull ( baseURI ) ) { getClient ( ) . sendAdd ( new URL ( url . toString ( ) ) . openStream ( ) , baseURI , dataFormat , contexts ) ; } else { getClient ( ) .... | add triples via URL |
132,978 | protected void addWithoutCommit ( Resource subject , URI predicate , Value object , Resource ... contexts ) throws RepositoryException { add ( subject , predicate , object , contexts ) ; } | add without commit |
132,979 | protected void removeWithoutCommit ( Resource subject , URI predicate , Value object , Resource ... contexts ) throws RepositoryException { remove ( subject , predicate , object , contexts ) ; } | remove without commit |
132,980 | public void setDefaultGraphPerms ( GraphPermissions graphPerms ) { if ( notNull ( graphPerms ) ) { this . defaultGraphPerms = graphPerms ; } else { this . defaultGraphPerms = client . emptyGraphPerms ( ) ; } } | sets default graph permissions to be used by all queries |
132,981 | public void configureWriteCache ( long initDelay , long delayCache , long cacheSize ) { client . initTimer ( initDelay , delayCache , cacheSize ) ; } | customise write cache interval and cache size . |
132,982 | private static Resource [ ] mergeResource ( Resource o , Resource ... arr ) { if ( o != null ) { Resource [ ] newArray = new Resource [ arr . length + 1 ] ; newArray [ 0 ] = o ; System . arraycopy ( arr , 0 , newArray , 1 , arr . length ) ; return newArray ; } else { return arr ; } } | private utility for merging Resource varargs |
132,983 | protected synchronized void flush ( ) throws RepositoryException , MalformedQueryException , UpdateExecutionException , IOException { if ( cache . isEmpty ( ) ) { return ; } StringBuffer entireQuery = new StringBuffer ( ) ; SPARQLQueryBindingSet bindingSet = new SPARQLQueryBindingSet ( ) ; for ( Namespace ns : cache . ... | flushes the cache writing triples as graph |
132,984 | public boolean evaluate ( ) throws QueryEvaluationException { try { sync ( ) ; return getMarkLogicClient ( ) . sendBooleanQuery ( getQueryString ( ) , getBindings ( ) , getIncludeInferred ( ) , getBaseURI ( ) ) ; } catch ( RepositoryException e ) { throw new QueryEvaluationException ( e . getMessage ( ) , e ) ; } catch... | evaluate boolean query |
132,985 | protected void handleClose ( ) throws QueryEvaluationException { try { super . handleClose ( ) ; } catch ( Exception e ) { logger . error ( "MarkLogicBackgroundGraphResult handleClose() stream closed exception" , e ) ; throw new QueryEvaluationException ( e ) ; } } | wrap exception debug log |
132,986 | public GraphQueryResult evaluate ( ) throws QueryEvaluationException { try { sync ( ) ; return getMarkLogicClient ( ) . sendGraphQuery ( getQueryString ( ) , getBindings ( ) , getIncludeInferred ( ) , getBaseURI ( ) ) ; } catch ( IOException e ) { throw new QueryEvaluationException ( e ) ; } catch ( MarkLogicSesameExce... | evaluate graph query |
132,987 | public void setBinding ( String name , String stringValue ) { bindingSet . addBinding ( name , ValueFactoryImpl . getInstance ( ) . createURI ( stringValue ) ) ; } | set individual binding |
132,988 | public void setBinding ( String name , Value value ) { bindingSet . addBinding ( name , value ) ; } | set individual binding and value |
132,989 | public TupleQueryResult evaluate ( long start , long pageLength ) throws QueryEvaluationException { try { sync ( ) ; return getMarkLogicClient ( ) . sendTupleQuery ( getQueryString ( ) , getBindings ( ) , start , pageLength , getIncludeInferred ( ) , getBaseURI ( ) ) ; } catch ( RepositoryException e ) { throw new Quer... | evaluate tuple query with pagination |
132,990 | public void execute ( ) throws UpdateExecutionException { try { sync ( ) ; getMarkLogicClient ( ) . sendUpdateQuery ( getQueryString ( ) , getBindings ( ) , getIncludeInferred ( ) , getBaseURI ( ) ) ; } catch ( ForbiddenUserException | FailedRequestException e ) { throw new UpdateExecutionException ( e ) ; } catch ( Re... | execute update query |
132,991 | public int getMatchLen ( int index , int distance , int limit ) { if ( _streamEndWasReached ) { if ( ( _pos + index ) + limit > _streamPos ) { limit = _streamPos - ( _pos + index ) ; } } distance ++ ; int pby = _bufferOffset + _pos + index ; int i ; for ( i = 0 ; i < limit && _bufferBase [ pby + i ] == _bufferBase [ pb... | index + limit have not to exceed _keepSizeAfter ; |
132,992 | public EtcdResponse get ( String key ) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder . fromUriString ( KEYSPACE ) ; builder . pathSegment ( key ) ; return execute ( builder , HttpMethod . GET , null , EtcdResponse . class ) ; } | Returns the node with the given key from etcd . |
132,993 | public EtcdResponse put ( final String key , final String value ) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder . fromUriString ( KEYSPACE ) ; builder . pathSegment ( key ) ; MultiValueMap < String , String > payload = new LinkedMultiValueMap < > ( 1 ) ; payload . set ( "value" , value ) ; ... | Sets the value of the node with the given key in etcd . Any previously existing key - value pair is returned as prevNode in the etcd response . |
132,994 | public EtcdResponse delete ( final String key ) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder . fromUriString ( KEYSPACE ) ; builder . pathSegment ( key ) ; return execute ( builder , HttpMethod . DELETE , null , EtcdResponse . class ) ; } | Deletes the node with the given key from etcd . |
132,995 | public EtcdMemberResponse listMembers ( ) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder . fromUriString ( MEMBERSPACE ) ; return execute ( builder , HttpMethod . GET , null , EtcdMemberResponse . class ) ; } | Returns a representation of all members in the etcd cluster . |
132,996 | private void updateMembers ( ) { try { List < String > locations = new ArrayList < String > ( ) ; EtcdMemberResponse response = listMembers ( ) ; EtcdMember [ ] members = response . getMembers ( ) ; for ( EtcdMember member : members ) { String [ ] clientUrls = member . getClientURLs ( ) ; if ( clientUrls != null ) { fo... | Updates the locations of the etcd cluster members . |
132,997 | private < T > T execute ( UriComponentsBuilder uriTemplate , HttpMethod method , MultiValueMap < String , String > requestData , Class < T > responseType ) throws EtcdException { long startTimeMillis = System . currentTimeMillis ( ) ; int retry = - 1 ; ResourceAccessException lastException = null ; do { lastException =... | Executes the given method on the given location using the given request data . |
132,998 | public static < X > Iterator < X > before ( final Iterator < X > iterator , final Runnable f ) { return new Iterator < X > ( ) { private final Runnable fOnlyOnce = new RunOnlyOnce ( f ) ; public boolean hasNext ( ) { fOnlyOnce . run ( ) ; return iterator . hasNext ( ) ; } public X next ( ) { fOnlyOnce . run ( ) ; retur... | Run f immediately before the first element of iterator is generated . Exceptions raised by f will prevent the requested behavior on the underlying iterator and can be handled by the caller . |
132,999 | public static < X > Iterator < X > after ( final Iterator < X > iterator , final Runnable f ) { return new Iterator < X > ( ) { private final Runnable fOnlyOnce = new RunOnlyOnce ( f ) ; public boolean hasNext ( ) { final boolean hasNext = iterator . hasNext ( ) ; if ( ! hasNext ) { fOnlyOnce . run ( ) ; } return hasNe... | Run f immediately after the last element of iterator is generated . Exceptions must not be raised by f . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.