idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
34,500 | public Attribute addAttribute ( QuotedID id , int type , String typeName , boolean canNull ) { Attribute att = new Attribute ( this , new QualifiedAttributeID ( getID ( ) , id ) , attributes . size ( ) + 1 , type , typeName , canNull , typeMapper . getTermType ( type , typeName ) ) ; Attribute prev = attributeMap . put... | creates a new attribute |
34,501 | public Attribute getAttribute ( int index ) { Attribute attribute = attributes . get ( index - 1 ) ; return attribute ; } | gets attribute with the specified position |
34,502 | public static boolean isIndempotent ( Map < Variable , Variable > substitutionMap ) { if ( substitutionMap . isEmpty ( ) ) return true ; Set < Variable > valueSet = new HashSet < > ( substitutionMap . values ( ) ) ; valueSet . retainAll ( substitutionMap . entrySet ( ) ) ; return valueSet . isEmpty ( ) ; } | Returns true if there is common variables in the domain and the range of the substitution map . |
34,503 | public InternalSparqlQuery translate ( ParsedQuery pq ) throws OntopUnsupportedInputQueryException , OntopInvalidInputQueryException { if ( predicateIdx != 0 || ! program . getRules ( ) . isEmpty ( ) ) throw new IllegalStateException ( "SparqlAlgebraToDatalogTranslator.translate can only be called once." ) ; TupleExpr ... | Translate a given SPARQL query object to datalog program . |
34,504 | public QueryTreeElement removeQuery ( String query_id ) { for ( QueryTreeElement query : queries ) { if ( query . getID ( ) . equals ( query_id ) ) { queries . remove ( query ) ; return query ; } } return null ; } | Removes a query from the group and returns the removed query or null if the query was not found in this group . |
34,505 | public QueryTreeElement getQuery ( String id ) { for ( QueryTreeElement query : queries ) { if ( query . getID ( ) . equals ( id ) ) { return query ; } } return null ; } | Searches a specific query and returns the object query else returns null . |
34,506 | private TreeNode getParentTreeNode ( TreeNode child ) { TreeNode parentTreeNode = parentIndex . get ( child ) ; if ( parentTreeNode == null ) return null ; else if ( contains ( parentTreeNode . getQueryNode ( ) ) ) return parentTreeNode ; else throw new RuntimeException ( "Internal error: points to a parent that is not... | The returned value might be null . |
34,507 | protected String getQueryString ( ) { if ( bindings . size ( ) == 0 ) return queryString ; String qry = queryString ; int b = qry . indexOf ( '{' ) ; String select = qry . substring ( 0 , b ) ; String where = qry . substring ( b ) ; for ( String name : bindings . getBindingNames ( ) ) { String replacement = getReplacem... | all code below is copy - pasted from org . eclipse . rdf4j . repository . sparql . query . SPARQLOperation |
34,508 | private Set < String > getBooleanConditions ( List < Function > atoms , AliasIndex index ) { Set < String > conditions = new LinkedHashSet < > ( ) ; for ( Function atom : atoms ) { if ( atom . isOperation ( ) ) { if ( atom . getFunctionSymbol ( ) == ExpressionOperation . AND ) { for ( Term t : atom . getTerms ( ) ) { S... | Returns a string with boolean conditions formed with the boolean atoms found in the atoms list . |
34,509 | private String getTableDefinitions ( List < Function > atoms , AliasIndex index , String JOIN_KEYWORD , boolean parenthesis , String indent ) { List < String > tables = getTableDefs ( atoms , index , INDENT + indent ) ; switch ( tables . size ( ) ) { case 0 : throw new RuntimeException ( "Cannot generate definition for... | Returns the table definition for these atoms . By default a list of atoms represents JOIN or LEFT JOIN of all the atoms left to right . All boolean atoms in the list are considered conditions in the ON clause of the JOIN . |
34,510 | private String getTableDefinition ( Function atom , AliasIndex index , String indent ) { if ( atom . isAlgebraFunction ( ) ) { Predicate functionSymbol = atom . getFunctionSymbol ( ) ; ImmutableList < Function > joinAtoms = convert ( atom . getTerms ( ) ) ; if ( functionSymbol . equals ( datalogFactory . getSparqlJoinP... | Returns the table definition for the given atom . If the atom is a simple table or view then it returns the value as defined by the AliasIndex . If the atom is a Join or Left Join it will call getTableDefinitions on the nested term list . |
34,511 | private int getDataType ( Term term ) { if ( term instanceof Function ) { Function f = ( Function ) term ; Predicate p = f . getFunctionSymbol ( ) ; if ( p instanceof DatatypePredicate ) { RDFDatatype type = ( ( DatatypePredicate ) p ) . getReturnedType ( ) ; return jdbcTypeMapper . getSQLType ( type ) ; } return Types... | return the SQL data type |
34,512 | private String getSelectClauseFragment ( SignatureVariable var , Term term , Optional < TermType > termType , AliasIndex index ) { String typeColumn = getTypeColumnForSELECT ( term , index , termType ) ; String langColumn = getLangColumnForSELECT ( term , index , termType ) ; String mainColumn = getMainColumnForSELECT ... | produces the select clause of the sql query for the given CQIE |
34,513 | private String getTypeColumnForSELECT ( Term ht , AliasIndex index , Optional < TermType > optionalTermType ) { if ( ht instanceof Variable ) { return index . getTypeColumn ( ( Variable ) ht ) . map ( QualifiedAttributeID :: getSQLRendering ) . orElseGet ( ( ) -> String . valueOf ( OBJECT . getQuestCode ( ) ) ) ; } els... | Infers the type of a projected term . |
34,514 | protected < T extends RelationDefinition > void add ( T td , Map < RelationID , T > schema ) { if ( ! isStillMutable ) { throw new IllegalStateException ( "Too late, cannot add a schema" ) ; } schema . put ( td . getID ( ) , td ) ; if ( td . getID ( ) . hasSchema ( ) ) { RelationID noSchemaID = td . getID ( ) . getSche... | Inserts a new data definition to this metadata object . |
34,515 | private List < ImmutableTerm > addToTermsList ( String str ) { ArrayList < ImmutableTerm > terms = new ArrayList < > ( ) ; int i , j ; String st ; str = str . substring ( 1 , str . length ( ) - 1 ) ; while ( str . contains ( "{" ) ) { i = getIndexOfCurlyB ( str ) ; if ( i > 0 ) { st = str . substring ( 0 , i ) ; st = s... | and adds parsed constant literals and template literal to terms list |
34,516 | private ImmutableTerm getNestedConcat ( String str ) { List < ImmutableTerm > terms ; terms = addToTermsList ( str ) ; if ( terms . size ( ) == 1 ) { return terms . get ( 0 ) ; } ImmutableFunctionalTerm f = termFactory . getImmutableFunctionalTerm ( ExpressionOperation . CONCAT , terms . get ( 0 ) , terms . get ( 1 ) )... | in case of more than two terms need to be concatted |
34,517 | private RDBMetadata extractDBMetadata ( SQLPPMapping ppMapping , Optional < RDBMetadata > optionalDBMetadata , OBDASpecInput specInput ) throws DBMetadataExtractionException { boolean isDBMetadataProvided = optionalDBMetadata . isPresent ( ) ; if ( isDBMetadataProvided && ( ! settings . isProvidedDBMetadataCompletionEn... | Makes use of the DB connection |
34,518 | private ImmutableMap < Predicate , ImmutableList < TermType > > extractCastTypeMap ( Multimap < Predicate , CQIE > ruleIndex , List < Predicate > predicatesInBottomUp , ImmutableMap < CQIE , ImmutableList < Optional < TermType > > > termTypeMap , DBMetadata metadata ) { Map < Predicate , ImmutableList < TermType > > mu... | Infers cast types for each predicate in the bottom up order |
34,519 | private ImmutableList < TermType > inferCastTypes ( Predicate predicate , Collection < CQIE > samePredicateRules , ImmutableMap < CQIE , ImmutableList < Optional < TermType > > > termTypeMap , Map < Predicate , ImmutableList < TermType > > alreadyKnownCastTypes , DBMetadata metadata ) { if ( samePredicateRules . isEmpt... | Infers the cast types for one intensional predicate |
34,520 | private ImmutableMultimap < Integer , TermType > collectProposedCastTypes ( Collection < CQIE > samePredicateRules , ImmutableMap < CQIE , ImmutableList < Optional < TermType > > > termTypeMap , Map < Predicate , ImmutableList < TermType > > alreadyKnownCastTypes ) { ImmutableMultimap . Builder < Integer , TermType > i... | Collects the proposed cast types by the definitions of the current predicate |
34,521 | private TermType getCastTypeFromSubRule ( ImmutableTerm term , ImmutableList < Function > bodyDataAtoms , Map < Predicate , ImmutableList < TermType > > alreadyKnownCastTypes ) { if ( term instanceof Variable ) { Variable variable = ( Variable ) term ; for ( Function bodyDataAtom : bodyDataAtoms ) { List < Term > argum... | Extracts the cast type of one projected variable from the body atom that provides it . |
34,522 | public static ForeignKeyConstraint of ( String name , Attribute attribute , Attribute reference ) { return new Builder ( ( DatabaseRelationDefinition ) attribute . getRelation ( ) , ( DatabaseRelationDefinition ) reference . getRelation ( ) ) . add ( attribute , reference ) . build ( name ) ; } | creates a single - attribute foreign key |
34,523 | private InputQuery parseQueryString ( String queryString ) throws OntopOWLException { try { return inputQueryFactory . createSPARQLQuery ( queryString ) ; } catch ( OntopInvalidInputQueryException | OntopUnsupportedInputQueryException e ) { throw new OntopOWLException ( e ) ; } } | In contexts where we don t know the precise type |
34,524 | public RepositoryConnection getConnection ( ) throws RepositoryException { try { return new OntopRepositoryConnection ( this , getOntopConnection ( ) , inputQueryFactory ) ; } catch ( Exception e ) { logger . error ( "Error creating repo connection: " + e . getMessage ( ) ) ; throw new RepositoryException ( e ) ; } } | Returns a new RepositoryConnection . |
34,525 | private static String getProperPrefixURI ( String prefixUri ) { if ( ! prefixUri . endsWith ( "#" ) ) { if ( ! prefixUri . endsWith ( "/" ) ) { String defaultSeparator = EntityCreationPreferences . getDefaultSeparator ( ) ; if ( ! prefixUri . endsWith ( defaultSeparator ) ) { prefixUri += defaultSeparator ; } } } retur... | A utility method to ensure a proper naming for prefix URI |
34,526 | private void fireMappingDeleted ( URI srcuri , String mapping_id ) { for ( OBDAMappingListener listener : mappingListeners ) { listener . mappingDeleted ( srcuri ) ; } } | Announces to the listeners that a mapping was deleted . |
34,527 | private void updateRuleIndexes ( CQIE rule ) { Function head = rule . getHead ( ) ; ruleIndex . put ( head . getFunctionSymbol ( ) , rule ) ; updateRuleIndexByBodyPredicate ( rule ) ; } | This method takes a rule and populates the ruleIndex field . |
34,528 | public boolean contains ( String prefix ) { Set < String > prefixes = prefixToURIMap . keySet ( ) ; return prefixes . contains ( prefix ) ; } | Checks if the prefix manager stores the prefix name . |
34,529 | public void intersectWith ( Intersection < T > arg ) { if ( arg . elements != null ) { if ( arg . elements . isEmpty ( ) ) elements = Collections . emptySet ( ) ; else { if ( elements == null ) elements = new HashSet < > ( arg . elements ) ; else elements . retainAll ( arg . elements ) ; } } } | modifies by intersecting with another intersection |
34,530 | public List < String [ ] > getTabularData ( ) throws OWLException , InterruptedException { if ( tabularData == null ) { tabularData = new ArrayList < > ( ) ; String [ ] columnName = results . getSignature ( ) . toArray ( new String [ numcols ] ) ; tabularData . add ( columnName ) ; while ( this . isFetching ) { Thread ... | Fetch all the tuples returned by the result set . |
34,531 | private void validateFields ( ) throws RepositoryConfigException { try { if ( owlFile . filter ( f -> ! f . exists ( ) ) . isPresent ( ) ) { throw new RepositoryConfigException ( String . format ( "The OWL file %s does not exist!" , owlFile . get ( ) . getAbsolutePath ( ) ) ) ; } if ( owlFile . filter ( f -> ! f . canR... | Checks that the fields are not missing and that files exist and are accessible . |
34,532 | public NodeCentricOptimizationResults < UnionNode > apply ( FlattenUnionProposal proposal , IntermediateQuery query , QueryTreeComponent treeComponent ) throws InvalidQueryOptimizationProposalException , EmptyQueryException { UnionNode focusNode = proposal . getFocusNode ( ) ; IntermediateQuery snapShot = query . creat... | Replace the child subtrees of the focus node |
34,533 | public boolean getValue ( ) throws OntopConnectionException { if ( hasRead ) throw new IllegalStateException ( "getValue() can only called once!" ) ; hasRead = true ; try { return set . next ( ) ; } catch ( SQLException e ) { throw new OntopConnectionException ( e ) ; } } | Returns true if there is at least one result |
34,534 | private void validateNode ( ) throws InvalidQueryNodeException { ImmutableSet < Variable > substitutionDomain = substitution . getDomain ( ) ; if ( ! projectedVariables . containsAll ( substitutionDomain ) ) { throw new InvalidQueryNodeException ( "ConstructionNode: all the domain variables " + "of the substitution mus... | Validates the node independently of its child |
34,535 | private void insertVariableDataTyping ( Term term , Function atom , int position , Map < String , List < IndexedPosition > > termOccurenceIndex ) throws UnknownDatatypeException { if ( term instanceof Function ) { Function function = ( Function ) term ; Predicate functionSymbol = function . getFunctionSymbol ( ) ; if (... | This method wraps the variable that holds data property values with a data type predicate . It will replace the variable with a new function symbol and update the rule atom . However if the users already defined the data - type in the mapping this method simply accepts the function symbol . |
34,536 | private void insertOperationDatatyping ( Term term , Function atom , int position ) throws UnknownDatatypeException { ImmutableTerm immutableTerm = immutabilityTools . convertIntoImmutableTerm ( term ) ; if ( immutableTerm instanceof ImmutableFunctionalTerm ) { ImmutableFunctionalTerm castTerm = ( ImmutableFunctionalTe... | Following r2rml standard we do not infer the datatype for operation but we return the default value string |
34,537 | private RDFDatatype getDataType ( Map < String , List < IndexedPosition > > termOccurenceIndex , Variable variable ) throws UnknownDatatypeException { List < IndexedPosition > list = termOccurenceIndex . get ( variable . getName ( ) ) ; if ( list == null ) throw new UnboundTargetVariableException ( variable ) ; Indexed... | returns COL_TYPE for one of the datatype ids |
34,538 | private Optional < InjectiveVar2VarSubstitution > computeRenamingSubstitution ( DistinctVariableOnlyDataAtom sourceProjectionAtom , DistinctVariableOnlyDataAtom targetProjectionAtom ) { int arity = sourceProjectionAtom . getEffectiveArity ( ) ; if ( ! sourceProjectionAtom . getPredicate ( ) . equals ( targetProjectionA... | When such substitution DO NOT EXIST returns an EMPTY OPTIONAL . When NO renaming is NEEDED returns an EMPTY SUBSTITUTION . |
34,539 | public int getTupleCount ( InputQuery inputQuery ) throws OntopReformulationException , OntopQueryEvaluationException { SQLExecutableQuery targetQuery = checkAndConvertTargetQuery ( getExecutableQuery ( inputQuery ) ) ; String sql = targetQuery . getSQL ( ) ; String newsql = "SELECT count(*) FROM (" + sql + ") t1" ; if... | Returns the number of tuples returned by the query |
34,540 | private void nestedEQSubstitutions ( Function atom , Substitution mgu ) { List < Term > terms = atom . getTerms ( ) ; for ( int i = 0 ; i < terms . size ( ) ; i ++ ) { Term t = terms . get ( i ) ; if ( t instanceof Function ) { Function t2 = ( Function ) t ; substitutionUtilities . applySubstitution ( t2 , mgu ) ; if (... | We search for equalities in conjunctions . This recursive methods explore AND functions and removes EQ functions substituting the values using the class |
34,541 | public < T extends ImmutableTerm > Optional < ImmutableSubstitution < T > > applyToSubstitution ( ImmutableSubstitution < T > substitution ) { return Optional . of ( applyRenaming ( substitution ) ) ; } | More efficient implementation |
34,542 | private static ImmutableList < Function > getJoinOnFilter ( RAExpressionAttributes re1 , RAExpressionAttributes re2 , ImmutableSet < QuotedID > using , TermFactory termFactory ) { return using . stream ( ) . map ( id -> new QualifiedAttributeID ( null , id ) ) . map ( id -> { Term v1 = re1 . getAttributes ( ) . get ( i... | internal implementation of JOIN USING and NATURAL JOIN |
34,543 | public ImmutableTerm convertIntoImmutableTerm ( Term term ) { if ( term instanceof Function ) { if ( term instanceof Expression ) { Expression expression = ( Expression ) term ; return termFactory . getImmutableExpression ( expression ) ; } else { Function functionalTerm = ( Function ) term ; if ( functionalTerm . getF... | In case the term is functional creates an immutable copy of it . |
34,544 | public Expression convertToMutableBooleanExpression ( ImmutableExpression booleanExpression ) { OperationPredicate pred = booleanExpression . getFunctionSymbol ( ) ; return termFactory . getExpression ( pred , convertToMutableTerms ( booleanExpression . getTerms ( ) ) ) ; } | This method takes a immutable boolean term and convert it into an old mutable boolean function . |
34,545 | private static List < RelationID > getTableList ( String defaultTableSchema , Set < RelationID > realTables , QuotedIDFactory idfac ) throws SQLException { List < RelationID > fks = new LinkedList < > ( ) ; for ( RelationID table : realTables ) { if ( table . hasSchema ( ) || ( defaultTableSchema == null ) || table . g... | Retrieve the normalized list of tables from a given list of RelationIDs |
34,546 | private static List < RelationID > getTableList ( Connection conn , RelationListProvider relationListProvider , QuotedIDFactory idfac ) throws SQLException { List < RelationID > relationIds = new LinkedList < > ( ) ; try ( Statement stmt = conn . createStatement ( ) ; ResultSet rs = stmt . executeQuery ( relationListPr... | Retrieve metadata for a specific database engine |
34,547 | private static void getPrimaryKey ( DatabaseMetaData md , DatabaseRelationDefinition relation , QuotedIDFactory idfac ) throws SQLException { RelationID id = relation . getID ( ) ; try ( ResultSet rs = md . getPrimaryKeys ( null , id . getSchemaName ( ) , id . getTableName ( ) ) ) { extractPrimaryKey ( relation , idfac... | Retrieves the primary key for the table |
34,548 | private static void getForeignKeys ( DatabaseMetaData md , DatabaseRelationDefinition relation , DBMetadata metadata ) throws SQLException { QuotedIDFactory idfac = metadata . getQuotedIDFactory ( ) ; RelationID relationId = relation . getID ( ) ; try ( ResultSet rs = md . getImportedKeys ( null , relationId . getSchem... | Retrieves the foreign keys for the table |
34,549 | protected PredicateLevelProposal proposeForGroupingMap ( ImmutableMultimap < ImmutableList < VariableOrGroundTerm > , ExtensionalDataNode > groupingMap ) throws AtomUnificationException { ImmutableCollection < Collection < ExtensionalDataNode > > dataNodeGroups = groupingMap . asMap ( ) . values ( ) ; try { ImmutableSe... | groupingMap groups data nodes that are being joined on the unique constraints |
34,550 | private static < T extends QueryNode > NodeCentricOptimizationResults < T > propagateSubstitution ( IntermediateQuery query , Optional < ImmutableSubstitution < VariableOrGroundTerm > > optionalSubstitution , T topNode ) throws EmptyQueryException { if ( optionalSubstitution . isPresent ( ) ) { SubstitutionPropagationP... | Applies the substitution from the topNode . |
34,551 | private synchronized void removeResultTable ( ) { OWLResultSetTableModel tm = getTableModel ( ) ; if ( tm != null ) { tm . close ( ) ; } resultTablePanel . setTableModel ( new DefaultTableModel ( ) ) ; } | removes the result table . Could be called at data query execution or at cancelling Not necessary when replacing with a new result just to remove old results that are outdated |
34,552 | public void setupListeners ( ) { QueryInterfaceViewsList queryInterfaceViews = ( QueryInterfaceViewsList ) this . getOWLEditorKit ( ) . get ( QueryInterfaceViewsList . class . getName ( ) ) ; if ( ( queryInterfaceViews == null ) ) { queryInterfaceViews = new QueryInterfaceViewsList ( ) ; getOWLEditorKit ( ) . put ( Que... | On creation of a new view we register it globally and make sure that its selector is listened by all other instances of query view in this editor kit . Also we make this new instance listen to the selection of all other query selectors in the views . |
34,553 | private List < Assertion > processResults ( OntopBindingSet bindingSet ) throws OntopResultConversionException , OntopConnectionException { List < Assertion > tripleAssertions = new ArrayList < > ( ) ; ABoxAssertionSupplier builder = OntologyBuilderImpl . assertionSupplier ( rdfFactory ) ; for ( ProjectionElemList peLi... | The method to actually process the current result set Row . Construct a list of assertions from the current result set row . In case of describe it is called to process and store all the results from a resultset . In case of construct it is called upon next to process the only current result set . |
34,554 | public QuestOWLEmptyEntitiesChecker getEmptyEntitiesChecker ( ) throws Exception { OWLOntology rootOntology = getRootOntology ( ) ; Ontology mergeOntology = owlapiTranslator . translateAndClassify ( rootOntology ) ; ClassifiedTBox tBox = mergeOntology . tbox ( ) ; return new QuestOWLEmptyEntitiesChecker ( tBox , owlCon... | Methods to get the empty concepts and roles in the ontology using the given mappings . It generates SPARQL queries to check for entities . |
34,555 | public OWLConnection replaceConnection ( ) throws OntopConnectionException { OWLConnection oldconn = this . owlConnection ; owlConnection = reasoner . getConnection ( ) ; return oldconn ; } | Replaces the owl connection with a new one Called when the user cancels a query . Easier to get a new connection than waiting for the cancel |
34,556 | private DistinctVariableOnlyDataAtom transformProjectionAtom ( DistinctVariableOnlyDataAtom atom ) { ImmutableList < Variable > newArguments = atom . getArguments ( ) . stream ( ) . map ( renamingSubstitution :: applyToVariable ) . collect ( ImmutableCollectors . toList ( ) ) ; return atomFactory . getDistinctVariableO... | Renames the projected variables |
34,557 | public ImmutableList < SQLPPTriplesMap > getMappings ( Graph myModel ) throws InvalidR2RMLMappingException { List < SQLPPTriplesMap > mappings = new ArrayList < SQLPPTriplesMap > ( ) ; Collection < TriplesMap > tripleMaps = r2rmlParser . getMappingNodes ( myModel ) ; for ( TriplesMap tm : tripleMaps ) { SQLPPTriplesMap... | This method return the list of mappings from the Model main method to be called assembles everything |
34,558 | private SQLPPTriplesMap getMapping ( TriplesMap tm ) throws Exception { String sourceQuery = r2rmlParser . getSQLQuery ( tm ) . trim ( ) ; ImmutableList < TargetAtom > body = getMappingTripleAtoms ( tm ) ; SQLPPTriplesMap mapping = new OntopNativeSQLPPTriplesMap ( "mapping-" + tm . hashCode ( ) , MAPPING_FACTORY . getS... | Get OBDA mapping axiom from R2RML TriplesMap |
34,559 | private List < SQLPPTriplesMap > getJoinMappings ( Collection < TriplesMap > tripleMaps , TriplesMap tm ) throws Exception { String sourceQuery = "" ; List < SQLPPTriplesMap > joinMappings = new ArrayList < SQLPPTriplesMap > ( ) ; for ( PredicateObjectMap pobm : tm . getPredicateObjectMaps ( ) ) { for ( RefObjectMap ro... | Get join OBDA mapping axiom from R2RML TriplesMap |
34,560 | private ImmutableList < TargetAtom > getMappingTripleAtoms ( TriplesMap tm ) throws Exception { ImmutableList . Builder < TargetAtom > bodyBuilder = ImmutableList . builder ( ) ; ImmutableTerm subjectAtom = r2rmlParser . getSubjectAtom ( tm ) ; List < ImmutableFunctionalTerm > classPredicates = r2rmlParser . getClassPr... | Get OBDA mapping body terms from R2RML TriplesMap |
34,561 | public Connection createConnection ( String url , String username , String password ) throws SQLException { if ( connection != null && ! connection . isClosed ( ) ) return connection ; connection = DriverManager . getConnection ( url , username , password ) ; return connection ; } | Constructs a new database connection object and retrieves it . |
34,562 | public Connection getConnection ( String url , String username , String password ) throws SQLException { boolean alive = isConnectionAlive ( ) ; if ( ! alive ) { createConnection ( url , username , password ) ; } return connection ; } | Retrieves the connection object . If the connection doesnt exist or is dead it will attempt to create a new connection . |
34,563 | static ClassifiedTBox classify ( OntologyImpl . UnclassifiedOntologyTBox onto ) { DefaultDirectedGraph < ObjectPropertyExpression , DefaultEdge > objectPropertyGraph = getObjectPropertyGraph ( onto ) ; EquivalencesDAGImpl < ObjectPropertyExpression > objectPropertyDAG = EquivalencesDAGImpl . getEquivalencesDAG ( object... | constructs a TBox reasoner from an ontology |
34,564 | private static DefaultDirectedGraph < ObjectPropertyExpression , DefaultEdge > getObjectPropertyGraph ( OntologyImpl . UnclassifiedOntologyTBox ontology ) { DefaultDirectedGraph < ObjectPropertyExpression , DefaultEdge > graph = new DefaultDirectedGraph < > ( DefaultEdge . class ) ; for ( ObjectPropertyExpression role ... | graph representation of object property inclusions in the ontology |
34,565 | private static DefaultDirectedGraph < DataPropertyExpression , DefaultEdge > getDataPropertyGraph ( OntologyImpl . UnclassifiedOntologyTBox ontology ) { DefaultDirectedGraph < DataPropertyExpression , DefaultEdge > graph = new DefaultDirectedGraph < > ( DefaultEdge . class ) ; for ( DataPropertyExpression role : ontolo... | graph representation of data property inclusions in the ontology |
34,566 | private static DefaultDirectedGraph < ClassExpression , DefaultEdge > getClassGraph ( OntologyImpl . UnclassifiedOntologyTBox ontology , DefaultDirectedGraph < ObjectPropertyExpression , DefaultEdge > objectPropertyGraph , DefaultDirectedGraph < DataPropertyExpression , DefaultEdge > dataPropertyGraph ) { DefaultDirect... | graph representation of the class inclusions in the ontology |
34,567 | protected boolean moveCursor ( ) throws SQLException , OntopConnectionException { boolean foundFreshRow ; List < Object > currentKey ; do { foundFreshRow = rs . next ( ) ; if ( ! foundFreshRow ) { break ; } currentKey = computeRowKey ( rs ) ; } while ( ! rowKeys . add ( currentKey ) ) ; return foundFreshRow ; } | Moves cursor until we get a fresh row |
34,568 | public List < ImmutableFunctionalTerm > getClassPredicates ( ) { List < ImmutableFunctionalTerm > classes = new ArrayList < > ( ) ; for ( ImmutableFunctionalTerm p : classPredicates ) classes . add ( p ) ; classPredicates . clear ( ) ; return classes ; } | Get classes They can be retrieved only once after retrieving everything is cleared . |
34,569 | public List < ImmutableFunctionalTerm > getBodyURIPredicates ( PredicateObjectMap pom ) { List < ImmutableFunctionalTerm > predicateAtoms = new ArrayList < > ( ) ; for ( PredicateMap pm : pom . getPredicateMaps ( ) ) { String pmConstant = pm . getConstant ( ) . toString ( ) ; if ( pmConstant != null ) { ImmutableFuncti... | Get body predicates with templates |
34,570 | private ImmutableFunctionalTerm getTermTypeAtom ( String string , Object type , String joinCond ) { if ( type . equals ( R2RMLVocabulary . iri ) ) { return getURIFunction ( string , joinCond ) ; } else if ( type . equals ( R2RMLVocabulary . blankNode ) ) { return getTypedFunction ( string , 2 , joinCond ) ; } else if (... | get a typed atom of a specific type |
34,571 | private String trim ( String string ) { while ( string . startsWith ( "\"" ) && string . endsWith ( "\"" ) ) { string = string . substring ( 1 , string . length ( ) - 1 ) ; } return string ; } | method that trims a string of all its double apostrophes from beginning and end |
34,572 | private String trimTo1 ( String string ) { while ( string . startsWith ( "\"\"" ) && string . endsWith ( "\"\"" ) ) { string = string . substring ( 1 , string . length ( ) - 1 ) ; } return string ; } | method to trim a string of its leading or trailing quotes but one |
34,573 | private IntermediateQuery pushDownExpressions ( final IntermediateQuery initialQuery ) { Optional < QueryNode > optionalCurrentNode = initialQuery . getFirstChild ( initialQuery . getRootNode ( ) ) ; IntermediateQuery currentQuery = initialQuery ; while ( optionalCurrentNode . isPresent ( ) ) { final QueryNode currentN... | Tries to optimize all the JoinOrFilterNodes ONE BY ONE . Navigates in a top - down fashion . |
34,574 | private NextNodeAndQuery optimizeJoinOrFilter ( IntermediateQuery currentQuery , JoinOrFilterNode currentNode ) { Optional < PushDownBooleanExpressionProposal > optionalProposal = makeProposal ( currentQuery , currentNode ) ; if ( optionalProposal . isPresent ( ) ) { PushDownBooleanExpressionProposal proposal = optiona... | Tries to optimize one JoinOrFilterNode . Returns information for the continuing the navigation in the possibly new IntermediateQuery . |
34,575 | private Optional < PushDownBooleanExpressionProposal > buildProposal ( JoinOrFilterNode providerNode , ImmutableMultimap < Recipient , ImmutableExpression > recipientMap ) { ImmutableCollection < Map . Entry < Recipient , ImmutableExpression > > recipientEntries = recipientMap . entries ( ) ; ImmutableMultimap < Commut... | Builds the PushDownBooleanExpressionProposal . |
34,576 | public void updateStatus ( long result ) { if ( result != - 1 ) { Double time = execTime / 1000 ; String s = String . format ( "Execution time: %s sec - Number of rows retrieved: %,d " , time , result ) ; Runnable time_setter = new ExecTimeSetter ( s ) ; SwingUtilities . invokeLater ( time_setter ) ; } } | get and update the info box with the actual time in seconds of the execution of the query |
34,577 | public void showBooleanActionResultInTextInfo ( String title , BooleanOWLResultSet result ) throws OWLException { AskQueryInfoSetter alter_result_panel = new AskQueryInfoSetter ( title , result ) ; SwingUtilities . invokeLater ( alter_result_panel ) ; } | show the result for ask query |
34,578 | public void tableChanged ( TableModelEvent e ) { int rows = ( ( TableModel ) e . getSource ( ) ) . getRowCount ( ) ; updateStatus ( rows ) ; } | update the number of rows when the table change |
34,579 | public boolean containsTerm ( Term t ) { List < Term > terms = getTerms ( ) ; for ( int i = 0 ; i < terms . size ( ) ; i ++ ) { Term t2 = terms . get ( i ) ; if ( t2 . equals ( t ) ) return true ; } return false ; } | Check whether the function contains a particular term argument or not . |
34,580 | private ImmutableList < UnaryOperatorNode > extractModifierNodes ( IntermediateQueryFactory iqFactory ) { long correctedOffset = offset > 0 ? offset : 0 ; Optional < SliceNode > sliceNode = Optional . of ( limit ) . filter ( l -> l >= 0 ) . map ( l -> Optional . of ( iqFactory . createSliceNode ( correctedOffset , l ) ... | Top - down order |
34,581 | private LiftingStepResults liftChildBinding ( ImmutableList < IQTree > initialChildren , Optional < ImmutableExpression > initialJoiningCondition , VariableGenerator variableGenerator ) throws EmptyIQException { ImmutableList < IQTree > liftedChildren = initialChildren . stream ( ) . map ( c -> c . liftBinding ( variab... | Lifts the binding OF AT MOST ONE child |
34,582 | public void synchronize ( List < QueryControllerEntity > queryEntities ) { if ( queryEntities . size ( ) > 0 ) { for ( QueryControllerEntity queryEntity : queryEntities ) { if ( queryEntity instanceof QueryControllerGroup ) { QueryControllerGroup group = ( QueryControllerGroup ) queryEntity ; QueryGroupTreeElement quer... | Takes all the existing nodes and constructs the tree . |
34,583 | public void reset ( ) { Enumeration < TreeNode > children = root . children ( ) ; while ( children . hasMoreElements ( ) ) { removeNodeFromParent ( ( MutableTreeNode ) children . nextElement ( ) ) ; children = root . children ( ) ; } } | Remove all the nodes from the Tree |
34,584 | public void elementAdded ( QueryControllerEntity element ) { if ( element instanceof QueryControllerGroup ) { QueryControllerGroup group = ( QueryControllerGroup ) element ; QueryGroupTreeElement ele = new QueryGroupTreeElement ( group . getID ( ) ) ; insertNodeInto ( ele , ( DefaultMutableTreeNode ) root , root . getC... | Inserts a new node group or query into the Tree |
34,585 | public void elementRemoved ( QueryControllerEntity element ) { if ( element instanceof QueryControllerGroup ) { QueryControllerGroup group = ( QueryControllerGroup ) element ; QueryGroupTreeElement ele = new QueryGroupTreeElement ( group . getID ( ) ) ; Enumeration < TreeNode > groups = root . children ( ) ; while ( gr... | Removes a TreeNode group or query from the Tree |
34,586 | public TreeElement getNode ( String element ) { TreeElement node = null ; Enumeration < TreeNode > elements = root . children ( ) ; while ( elements . hasMoreElements ( ) ) { TreeElement currentNode = ( TreeElement ) elements . nextElement ( ) ; if ( currentNode instanceof QueryGroupTreeElement ) { QueryGroupTreeElemen... | Search a TreeElement node group or query and returns the object else returns null . |
34,587 | public QueryTreeElement getElementQuery ( String element , String group ) { QueryTreeElement node = null ; Enumeration < TreeNode > elements = root . children ( ) ; while ( elements . hasMoreElements ( ) ) { TreeElement currentNode = ( TreeElement ) elements . nextElement ( ) ; if ( currentNode instanceof QueryGroupTre... | Search a query node in a group and returns the object else returns null . |
34,588 | public static Optional < QueryNode > getDepthFirstNextNode ( IntermediateQuery query , QueryNode currentNode ) { return getDepthFirstNextNode ( query , currentNode , false ) ; } | Depth - first exploration |
34,589 | public static NextNodeAndQuery getNextNodeAndQuery ( IntermediateQuery query , NodeCentricOptimizationResults < ? extends QueryNode > results ) { Optional < ? extends QueryNode > optionalNewNode = results . getOptionalNewNode ( ) ; if ( optionalNewNode . isPresent ( ) ) { Optional < QueryNode > optionalNextNode = getDe... | Finds the next node to visit in a new intermediate query |
34,590 | private String stringifySubTree ( IntermediateQuery query , QueryNode subTreeRoot , String rootOffsetString ) { StringBuilder strBuilder = new StringBuilder ( ) ; strBuilder . append ( rootOffsetString + subTreeRoot + "\n" ) ; for ( QueryNode child : query . getChildren ( subTreeRoot ) ) { strBuilder . append ( stringi... | Recursive method . |
34,591 | public < T extends ImmutableTerm > ImmutableSubstitution < T > prioritizeRenaming ( ImmutableSubstitution < T > substitution , ImmutableSet < Variable > priorityVariables ) { ImmutableMultimap < Variable , Variable > renamingMultimap = substitution . getImmutableMap ( ) . entrySet ( ) . stream ( ) . filter ( e -> prior... | Prevents priority variables to be renamed into non - priority variables . |
34,592 | public Optional < ImmutableSubstitution < ImmutableTerm > > computeDirectedMGU ( ImmutableTerm sourceTerm , ImmutableTerm targetTerm ) { if ( sourceTerm instanceof Variable ) { Variable sourceVariable = ( Variable ) sourceTerm ; if ( ( targetTerm instanceof ImmutableFunctionalTerm ) && ( ( ImmutableFunctionalTerm ) tar... | Computes a MGU that reuses as much as possible the variables from the target part . |
34,593 | private void readSourceDeclaration ( LineNumberReader reader ) throws IOException { String line ; dataSourceProperties = new Properties ( ) ; while ( ! ( line = reader . readLine ( ) ) . isEmpty ( ) ) { int lineNumber = reader . getLineNumber ( ) ; String [ ] tokens = line . split ( "[\t| ]+" , 2 ) ; final String param... | read and store datasource information |
34,594 | public DatalogProgram createDatalog ( OWLOntology onto ) { for ( OWLAxiom axiom : onto . getAxioms ( ) ) { if ( axiom . getAxiomType ( ) . equals ( AxiomType . SWRL_RULE ) ) { SWRLRule rule = ( SWRLRule ) axiom ; rule . accept ( this ) ; if ( notSupported ) { log . warn ( "Not Supported Translation of: " + errors ) ; e... | Translate the swrl_rules contained in the ontology Return a datalog program containing the supported datalog facts |
34,595 | public DatalogProgram createDatalog ( SWRLRule rule ) { rule . accept ( this ) ; if ( notSupported ) { log . warn ( "Not Supported Translation of: " + errors ) ; errors . clear ( ) ; } DatalogProgram dp = datalogFactory . getDatalogProgram ( ) ; dp . appendRule ( facts ) ; return dp ; } | Translate the swrl_rule Return a datalog program containing the supported datalog facts |
34,596 | public void visit ( SWRLDataRangeAtom node ) { notSupported = true ; errors . add ( node . toString ( ) ) ; } | Data range is not supported |
34,597 | private ImmutableSet < ExtensionalDataNode > selectNodesToRemove ( ImmutableSet < Variable > requiredAndCooccuringVariables , ImmutableMap < FunctionalDependency , ImmutableCollection < Collection < ExtensionalDataNode > > > constraintNodeMap , AtomPredicate predicate ) { if ( settings . getCardinalityPreservationMode ... | Does not look for redundant joins if not in the LOOSE preservation mode |
34,598 | private Stream < ImmutableExpression > extractEqualities ( ImmutableSubstitution < ImmutableTerm > substitution , ImmutableSet < Variable > leftVariables ) { return substitution . getImmutableMap ( ) . entrySet ( ) . stream ( ) . filter ( e -> leftVariables . contains ( e . getKey ( ) ) || leftVariables . contains ( e ... | Extracts equalities involving a left variable from the substitution |
34,599 | private LeftJoinNode liftSubstitution ( LeftJoinNode normalizedLeftJoin , ImmutableSubstitution < ImmutableTerm > remainingRightSubstitution , IntermediateQuery query ) { SubstitutionPropagationProposal < LeftJoinNode > proposal = new SubstitutionPropagationProposalImpl < > ( normalizedLeftJoin , remainingRightSubstitu... | Lifts the substitution in the absence of a LJ condition |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.