idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
9,200 | public String createTempJob ( String mcUrl , String mcUserName , String mcPassword , String proxyAddress , String proxyUserName , String proxyPassword ) { JSONObject job = null ; String jobId = null ; String hp4mSecret = null ; String jsessionId = null ; String loginJson = loginToMC ( mcUrl , mcUserName , mcPassword , ... | create one temp job |
9,201 | public JSONObject getJobById ( String mcUrl , String mcUserName , String mcPassword , String proxyAddress , String proxyUsername , String proxyPassword , String jobUUID ) { JSONObject jobJsonObject = null ; String hp4mSecret = null ; String jsessionId = null ; String loginJson = loginToMC ( mcUrl , mcUserName , mcPassw... | get one job by id |
9,202 | public List < Result . Suites > getSuites ( ) { if ( suites == null ) { suites = new ArrayList < Result . Suites > ( ) ; } return this . suites ; } | Gets the value of the suites property . |
9,203 | public MCServerSettingsModel getMCServerSettingsModel ( ) { for ( MCServerSettingsModel mcServer : getDescriptor ( ) . getMcServers ( ) ) { if ( this . runFromFileModel != null && runFromFileModel . getMcServerName ( ) != null && mcServer . getMcServerName ( ) != null && runFromFileModel . getMcServerName ( ) . equals ... | Gets mc server settings model . |
9,204 | static void constructPercentileTransactionGraph ( Map . Entry < String , LrProjectScenarioResults > scenarioResults , JSONObject scenarioGraphData ) { Map < Integer , TreeMap < String , PercentileTransactionWholeRun > > percentileTransactionResults = scenarioResults . getValue ( ) . getPercentileTransactionResults ( ) ... | creates dataset for Percentile transaction graph |
9,205 | static void constructAvgTransactionGraph ( Map . Entry < String , LrProjectScenarioResults > scenarioResults , JSONObject scenarioGraphData ) { Map < Integer , TreeMap < String , AvgTransactionResponseTime > > avgTransactionResponseTimeResults = scenarioResults . getValue ( ) . getAvgTransactionResponseTimeResults ( ) ... | Construct avg transaction graph . |
9,206 | static void constructErrorGraph ( Map . Entry < String , LrProjectScenarioResults > scenarioResults , JSONObject scenarioGraphData ) { Map < Integer , TimeRangeResult > errPerSecResults = scenarioResults . getValue ( ) . getErrPerSecResults ( ) ; JSONObject errPerSecResultsResultsGraphSet = extractTimeRangeResult ( err... | Construct error graph . |
9,207 | static void constructAverageThroughput ( Map . Entry < String , LrProjectScenarioResults > scenarioResults , JSONObject scenarioGraphData ) { Map < Integer , WholeRunResult > averageThroughputResults = scenarioResults . getValue ( ) . getAverageThroughputResults ( ) ; JSONObject averageThroughputResultsGraphSet = extra... | Construct average throughput . |
9,208 | static void constructTotalThroughputGraph ( Map . Entry < String , LrProjectScenarioResults > scenarioResults , JSONObject scenarioGraphData ) { Map < Integer , WholeRunResult > totalThroughputResults = scenarioResults . getValue ( ) . getTotalThroughtputResults ( ) ; JSONObject totalThroughputResultsGraphSet = extract... | Construct total throughput graph . |
9,209 | static void constructAvgHitsGraph ( Map . Entry < String , LrProjectScenarioResults > scenarioResults , JSONObject scenarioGraphData ) { Map < Integer , WholeRunResult > avgHitsPerSec = scenarioResults . getValue ( ) . getAverageHitsPerSecondResults ( ) ; JSONObject avgHitsPerSecGraphSet = extractWholeRunSlaResult ( av... | Construct avg hits graph . |
9,210 | 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 . |
9,211 | 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 |
9,212 | 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 . |
9,213 | 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 |
9,214 | 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 . |
9,215 | 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 . |
9,216 | 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 . |
9,217 | 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 |
9,218 | 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 |
9,219 | 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 . |
9,220 | 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 . |
9,221 | 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 . |
9,222 | 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 . |
9,223 | 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 |
9,224 | 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 . |
9,225 | 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 . |
9,226 | 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 . |
9,227 | 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 . |
9,228 | 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 |
9,229 | 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 |
9,230 | 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 |
9,231 | 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 . |
9,232 | 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 |
9,233 | 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 |
9,234 | 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 . |
9,235 | 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 . |
9,236 | public void waitForExit ( ) throws InterruptedException { try { dockerClient . waitContainer ( container . id ( ) ) ; } catch ( DockerException e ) { throw new IllegalStateException ( e ) ; } } | Block until container exit . |
9,237 | 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 . |
9,238 | 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 . |
9,239 | public DockerRuleBuilder env ( String envName , String envValue ) { env . add ( String . format ( "%s=%s" , envName , envValue ) ) ; return this ; } | Set environment variable in the container . |
9,240 | 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 . |
9,241 | 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 ... |
9,242 | 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 . |
9,243 | public void delete ( final Preauthorization preauthorization ) { RestfulUtils . delete ( PreauthorizationService . PATH , preauthorization , Preauthorization . class , super . httpClient ) ; } | This function deletes a preauthorization . |
9,244 | 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 . |
9,245 | public < O extends Schema > O setId ( String schemaId ) { getJson ( ) . put ( "id" , schemaId ) ; return ( O ) this ; } | Should be URI |
9,246 | 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 == > |
9,247 | 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 == > |
9,248 | 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 == > |
9,249 | 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 == > |
9,250 | 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 . |
9,251 | 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 |
9,252 | 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 |
9,253 | 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 . |
9,254 | 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 . |
9,255 | 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 |
9,256 | 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 |
9,257 | 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 |
9,258 | 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 |
9,259 | 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 |
9,260 | 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 |
9,261 | public void setGraphPerms ( GraphPermissions graphPerms ) { if ( graphPerms != null ) { getClient ( ) . setGraphPerms ( graphPerms ) ; } else { getClient ( ) . setGraphPerms ( getClient ( ) . getDatabaseClient ( ) . newGraphManager ( ) . newGraphPermissions ( ) ) ; } } | setter for GraphPermissions |
9,262 | 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 |
9,263 | private void setDatabaseClient ( DatabaseClient databaseClient ) { this . databaseClient = databaseClient ; this . sparqlManager = getDatabaseClient ( ) . newSPARQLQueryManager ( ) ; this . graphManager = getDatabaseClient ( ) . newGraphManager ( ) ; } | set databaseclient and instantate related managers |
9,264 | 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 |
9,265 | 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 |
9,266 | 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 |
9,267 | 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 |
9,268 | 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 |
9,269 | 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 |
9,270 | 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 |
9,271 | 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 |
9,272 | 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 |
9,273 | public Query prepareQuery ( String queryString , String baseURI ) throws RepositoryException , MalformedQueryException { return prepareQuery ( QueryLanguage . SPARQL , queryString , baseURI ) ; } | overload for prepareQuery |
9,274 | 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 |
9,275 | public MarkLogicGraphQuery prepareGraphQuery ( String queryString , String baseURI ) throws RepositoryException , MalformedQueryException { return prepareGraphQuery ( QueryLanguage . SPARQL , queryString , baseURI ) ; } | overload for prepareGraphQuery |
9,276 | public MarkLogicBooleanQuery prepareBooleanQuery ( String queryString ) throws RepositoryException , MalformedQueryException { return prepareBooleanQuery ( QueryLanguage . SPARQL , queryString , null ) ; } | overload for prepareBooleanQuery |
9,277 | public MarkLogicUpdateQuery prepareUpdate ( String queryString , String baseURI ) throws RepositoryException , MalformedQueryException { return prepareUpdate ( QueryLanguage . SPARQL , queryString , baseURI ) ; } | overload for prepareUpdate |
9,278 | 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 |
9,279 | 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 |
9,280 | 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 |
9,281 | 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 |
9,282 | 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 |
9,283 | 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 |
9,284 | 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 |
9,285 | 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 |
9,286 | 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 |
9,287 | 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 |
9,288 | protected void addWithoutCommit ( Resource subject , URI predicate , Value object , Resource ... contexts ) throws RepositoryException { add ( subject , predicate , object , contexts ) ; } | add without commit |
9,289 | protected void removeWithoutCommit ( Resource subject , URI predicate , Value object , Resource ... contexts ) throws RepositoryException { remove ( subject , predicate , object , contexts ) ; } | remove without commit |
9,290 | 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 |
9,291 | public void configureWriteCache ( long initDelay , long delayCache , long cacheSize ) { client . initTimer ( initDelay , delayCache , cacheSize ) ; } | customise write cache interval and cache size . |
9,292 | 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 |
9,293 | 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 |
9,294 | 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 |
9,295 | 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 |
9,296 | 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 |
9,297 | public void setBinding ( String name , String stringValue ) { bindingSet . addBinding ( name , ValueFactoryImpl . getInstance ( ) . createURI ( stringValue ) ) ; } | set individual binding |
9,298 | public void setBinding ( String name , Value value ) { bindingSet . addBinding ( name , value ) ; } | set individual binding and value |
9,299 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.