_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q162900
OneShotSQLGeneratorEngine.getSelectClauseFragment
train
private String getSelectClauseFragment(SignatureVariable var, Term term, Optional<TermType> termType, AliasIndex index) { /* * Datatype for the main column (to which it is cast). * Beware, it may defer the RDF datatype (the one of the type column). * * Why? Because m...
java
{ "resource": "" }
q162901
OneShotSQLGeneratorEngine.getTypeColumnForSELECT
train
private String getTypeColumnForSELECT(Term ht, AliasIndex index, Optional<TermType> optionalTermType) { if (ht instanceof Variable) { // Such variable does not hold this information, so we have to look // at the database metadata. return index.getTypeColumn((Variable) ht) .map(QualifiedAttr...
java
{ "resource": "" }
q162902
BasicDBMetadata.add
train
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.get...
java
{ "resource": "" }
q162903
AbstractTurtleOBDAVisitor.addToTermsList
train
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) { ...
java
{ "resource": "" }
q162904
AbstractTurtleOBDAVisitor.getNestedConcat
train
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), te...
java
{ "resource": "" }
q162905
SQLMappingExtractor.extractDBMetadata
train
private RDBMetadata extractDBMetadata(SQLPPMapping ppMapping, Optional<RDBMetadata> optionalDBMetadata, OBDASpecInput specInput) throws DBMetadataExtractionException { boolean isDBMetadataProvided = optionalDBMetadata.isPresent(); /* * Met...
java
{ "resource": "" }
q162906
TypeExtractor.extractCastTypeMap
train
private ImmutableMap<Predicate,ImmutableList<TermType>> extractCastTypeMap( Multimap<Predicate, CQIE> ruleIndex, List<Predicate> predicatesInBottomUp, ImmutableMap<CQIE, ImmutableList<Optional<TermType>>> termTypeMap, DBMetadata metadata) { // Append-only Map<Predicate,Immutable...
java
{ "resource": "" }
q162907
TypeExtractor.inferCastTypes
train
private ImmutableList<TermType> inferCastTypes( Predicate predicate, Collection<CQIE> samePredicateRules, ImmutableMap<CQIE, ImmutableList<Optional<TermType>>> termTypeMap, Map<Predicate, ImmutableList<TermType>> alreadyKnownCastTypes, DBMetadata metadata) { if (samePredicat...
java
{ "resource": "" }
q162908
TypeExtractor.collectProposedCastTypes
train
private ImmutableMultimap<Integer, TermType> collectProposedCastTypes( Collection<CQIE> samePredicateRules, ImmutableMap<CQIE, ImmutableList<Optional<TermType>>> termTypeMap, Map<Predicate, ImmutableList<TermType>> alreadyKnownCastTypes) { ImmutableMultimap.Builder<Integer, TermType> in...
java
{ "resource": "" }
q162909
TypeExtractor.getCastTypeFromSubRule
train
private TermType getCastTypeFromSubRule( ImmutableTerm term, ImmutableList<Function> bodyDataAtoms, Map<Predicate, ImmutableList<TermType>> alreadyKnownCastTypes) { if (term instanceof Variable) { Variable variable = (Variable) term; for (Function bo...
java
{ "resource": "" }
q162910
ForeignKeyConstraint.of
train
public static ForeignKeyConstraint of(String name, Attribute attribute, Attribute reference) { return new Builder((DatabaseRelationDefinition)attribute.getRelation(), (DatabaseRelationDefinition)reference.getRelation()) .add(attribute, reference).build(name); }
java
{ "resource": "" }
q162911
DefaultOntopOWLStatement.parseQueryString
train
private InputQuery parseQueryString(String queryString) throws OntopOWLException { try { return inputQueryFactory.createSPARQLQuery(queryString); } catch (OntopInvalidInputQueryException | OntopUnsupportedInputQueryException e) { throw new OntopOWLException(e); } }
java
{ "resource": "" }
q162912
OntopVirtualRepository.getConnection
train
@Override 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); } }
java
{ "resource": "" }
q162913
OBDAModelManager.getProperPrefixURI
train
private static String getProperPrefixURI(String prefixUri) { if (!prefixUri.endsWith("#")) { if (!prefixUri.endsWith("/")) { String defaultSeparator = EntityCreationPreferences.getDefaultSeparator(); if (!prefixUri.endsWith(defaultSeparator)) { prefixUri += defaultSeparator; } } } return p...
java
{ "resource": "" }
q162914
OBDAModel.fireMappingDeleted
train
private void fireMappingDeleted(URI srcuri, String mapping_id) { for (OBDAMappingListener listener : mappingListeners) { listener.mappingDeleted(srcuri); } }
java
{ "resource": "" }
q162915
DatalogDependencyGraphGenerator.updateRuleIndexes
train
private void updateRuleIndexes(CQIE rule) { Function head = rule.getHead(); ruleIndex.put(head.getFunctionSymbol(), rule); updateRuleIndexByBodyPredicate(rule); }
java
{ "resource": "" }
q162916
SimplePrefixManager.contains
train
@Override public boolean contains(String prefix) { Set<String> prefixes = prefixToURIMap.keySet(); return prefixes.contains(prefix); }
java
{ "resource": "" }
q162917
Intersection.intersectWith
train
public void intersectWith(Intersection<T> arg) { // if the argument is top then leave all as is if (arg.elements != null) { // if arg is empty, the result is empty if (arg.elements.isEmpty()) elements = Collections.emptySet(); else { if (elements == null) // we have top, the intersection is sub...
java
{ "resource": "" }
q162918
OWLResultSetTableModel.getTabularData
train
public List<String[]> getTabularData() throws OWLException, InterruptedException { if (tabularData == null) { tabularData = new ArrayList<>(); String[] columnName = results.getSignature().toArray(new String[numcols]); // Append the column names tabularData.add(columnName); while(this.isFetching){ ...
java
{ "resource": "" }
q162919
OntopRepositoryConfig.validateFields
train
private void validateFields() throws RepositoryConfigException { try { /* * Ontology file */ if (owlFile .filter(f -> !f.exists()) .isPresent()) { throw new RepositoryConfigException(String.format("The OWL ...
java
{ "resource": "" }
q162920
FlattenUnionExecutorImpl.apply
train
@Override public NodeCentricOptimizationResults<UnionNode> apply(FlattenUnionProposal proposal, IntermediateQuery query, QueryTreeComponent treeComponent) throws InvalidQueryOptimizationProposalException, EmptyQueryException { UnionNode focusNode = proposal.getFocusNode(); IntermediateQuery snapSho...
java
{ "resource": "" }
q162921
SQLBooleanResultSet.getValue
train
@Override 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 OntopConnectionExc...
java
{ "resource": "" }
q162922
ConstructionNodeImpl.validateNode
train
private void validateNode() throws InvalidQueryNodeException { ImmutableSet<Variable> substitutionDomain = substitution.getDomain(); // The substitution domain must be a subset of the projectedVariables if (!projectedVariables.containsAll(substitutionDomain)) { throw new InvalidQuer...
java
{ "resource": "" }
q162923
MappingDataTypeCompletion.insertVariableDataTyping
train
private void insertVariableDataTyping(Term term, Function atom, int position, Map<String, List<IndexedPosition>> termOccurenceIndex) throws UnknownDatatypeException { if (term instanceof Function) { Function function = (Function) term; Predica...
java
{ "resource": "" }
q162924
MappingDataTypeCompletion.insertOperationDatatyping
train
private void insertOperationDatatyping(Term term, Function atom, int position) throws UnknownDatatypeException { ImmutableTerm immutableTerm = immutabilityTools.convertIntoImmutableTerm(term); if (immutableTerm instanceof ImmutableFunctionalTerm) { ImmutableFunctionalTerm castTerm = (Immut...
java
{ "resource": "" }
q162925
MappingDataTypeCompletion.getDataType
train
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); ...
java
{ "resource": "" }
q162926
UnionBasedQueryMergerImpl.computeRenamingSubstitution
train
private Optional<InjectiveVar2VarSubstitution> computeRenamingSubstitution( DistinctVariableOnlyDataAtom sourceProjectionAtom, DistinctVariableOnlyDataAtom targetProjectionAtom) { int arity = sourceProjectionAtom.getEffectiveArity(); if (!sourceProjectionAtom.getPredicate().equ...
java
{ "resource": "" }
q162927
SQLQuestStatement.getTupleCount
train
@Override public int getTupleCount(InputQuery inputQuery) throws OntopReformulationException, OntopQueryEvaluationException { SQLExecutableQuery targetQuery = checkAndConvertTargetQuery(getExecutableQuery(inputQuery)); String sql = targetQuery.getSQL(); String newsql = "SELECT count(*) FROM ...
java
{ "resource": "" }
q162928
EQNormalizer.nestedEQSubstitutions
train
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; substitutionUt...
java
{ "resource": "" }
q162929
InjectiveVar2VarSubstitutionImpl.applyToSubstitution
train
@Override public <T extends ImmutableTerm> Optional<ImmutableSubstitution<T>> applyToSubstitution( ImmutableSubstitution<T> substitution) { return Optional.of(applyRenaming(substitution)); }
java
{ "resource": "" }
q162930
RAExpression.getJoinOnFilter
train
private static ImmutableList<Function> getJoinOnFilter(RAExpressionAttributes re1, RAExpressionAttributes re2, ImmutableSet<QuotedID> using, Te...
java
{ "resource": "" }
q162931
ImmutabilityTools.convertIntoImmutableTerm
train
public ImmutableTerm convertIntoImmutableTerm(Term term) { if (term instanceof Function) { if (term instanceof Expression) { Expression expression = (Expression) term; return termFactory.getImmutableExpression(expression); } else { Function...
java
{ "resource": "" }
q162932
ImmutabilityTools.convertToMutableBooleanExpression
train
public Expression convertToMutableBooleanExpression(ImmutableExpression booleanExpression) { OperationPredicate pred = booleanExpression.getFunctionSymbol(); return termFactory.getExpression(pred, convertToMutableTerms(booleanExpression.getTerms())); }
java
{ "resource": "" }
q162933
RDBMetadataExtractionTools.getTableList
train
private static List<RelationID> getTableList(String defaultTableSchema, Set<RelationID> realTables, QuotedIDFactory idfac) throws SQLException { List<RelationID> fks = new LinkedList<>(); for (RelationID table : realTables) { // defaultTableSchema is non-empty only for Oracle and DUAL is a special Oracle table ...
java
{ "resource": "" }
q162934
RDBMetadataExtractionTools.getTableList
train
private static List<RelationID> getTableList(Connection conn, RelationListProvider relationListProvider, QuotedIDFactory idfac) throws SQLException { // Obtain the relational objects (i.e., tables and views) List<RelationID> relationIds = new LinkedList<>(); try (Statement stmt = conn.createStatement(); Resu...
java
{ "resource": "" }
q162935
RDBMetadataExtractionTools.getPrimaryKey
train
private static void getPrimaryKey(DatabaseMetaData md, DatabaseRelationDefinition relation, QuotedIDFactory idfac) throws SQLException { RelationID id = relation.getID(); // Retrieves a description of the given table's primary key columns. They are ordered by COLUMN_NAME (sic!) try (ResultSet rs = md.getPrimaryKe...
java
{ "resource": "" }
q162936
RDBMetadataExtractionTools.getForeignKeys
train
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.getSchemaName(), relati...
java
{ "resource": "" }
q162937
SelfJoinLikeExecutor.proposeForGroupingMap
train
protected PredicateLevelProposal proposeForGroupingMap( ImmutableMultimap<ImmutableList<VariableOrGroundTerm>, ExtensionalDataNode> groupingMap) throws AtomUnificationException { ImmutableCollection<Collection<ExtensionalDataNode>> dataNodeGroups = groupingMap.asMap().values(); try { ...
java
{ "resource": "" }
q162938
SelfJoinLikeExecutor.propagateSubstitution
train
private static <T extends QueryNode> NodeCentricOptimizationResults<T> propagateSubstitution( IntermediateQuery query, Optional<ImmutableSubstitution<VariableOrGroundTerm>> optionalSubstitution, T topNode) throws EmptyQueryException { if (optionalSubstitution.isPresent()) { ...
java
{ "resource": "" }
q162939
QueryInterfaceView.removeResultTable
train
private synchronized void removeResultTable(){ OWLResultSetTableModel tm = getTableModel(); if (tm != null){ tm.close(); } resultTablePanel.setTableModel(new DefaultTableModel()); }
java
{ "resource": "" }
q162940
QueryInterfaceView.setupListeners
train
public void setupListeners() { // Getting the list of views QueryInterfaceViewsList queryInterfaceViews = (QueryInterfaceViewsList) this.getOWLEditorKit().get(QueryInterfaceViewsList.class.getName()); if ((queryInterfaceViews == null)) { queryInterfaceViews = new QueryInterfaceViewsList(); getOWLEditorKit(...
java
{ "resource": "" }
q162941
DefaultSimpleGraphResultSet.processResults
train
private List<Assertion> processResults(OntopBindingSet bindingSet) throws OntopResultConversionException, OntopConnectionException { List<Assertion> tripleAssertions = new ArrayList<>(); ABoxAssertionSupplier builder = OntologyBuilderImpl.assertionSupplier(rdfFactory); for (Project...
java
{ "resource": "" }
q162942
OntopProtegeReasoner.getEmptyEntitiesChecker
train
public QuestOWLEmptyEntitiesChecker getEmptyEntitiesChecker() throws Exception { OWLOntology rootOntology = getRootOntology(); Ontology mergeOntology = owlapiTranslator.translateAndClassify(rootOntology); ClassifiedTBox tBox = mergeOntology.tbox(); return new QuestOWLEmptyEntitiesChecke...
java
{ "resource": "" }
q162943
OntopProtegeReasoner.replaceConnection
train
public OWLConnection replaceConnection() throws OntopConnectionException { OWLConnection oldconn = this.owlConnection; owlConnection = reasoner.getConnection(); return oldconn; }
java
{ "resource": "" }
q162944
QueryRenamerImpl.transformProjectionAtom
train
private DistinctVariableOnlyDataAtom transformProjectionAtom(DistinctVariableOnlyDataAtom atom) { ImmutableList<Variable> newArguments = atom.getArguments().stream() .map(renamingSubstitution::applyToVariable) .collect(ImmutableCollectors.toList()); return atomFactory.ge...
java
{ "resource": "" }
q162945
R2RMLManager.getMappings
train
public ImmutableList<SQLPPTriplesMap> getMappings(Graph myModel) throws InvalidR2RMLMappingException { List<SQLPPTriplesMap> mappings = new ArrayList<SQLPPTriplesMap>(); // retrieve the TriplesMap nodes Collection<TriplesMap> tripleMaps = r2rmlParser.getMappingNodes(myModel); for (TriplesMap tm : tripleMaps)...
java
{ "resource": "" }
q162946
R2RMLManager.getMapping
train
private SQLPPTriplesMap getMapping(TriplesMap tm) throws Exception { String sourceQuery = r2rmlParser.getSQLQuery(tm).trim(); ImmutableList<TargetAtom> body = getMappingTripleAtoms(tm); //Function head = getHeadAtom(body); //CQIE targetQuery = DATALOG_FACTORY.getCQIE(head, body); // TODO: consider a R2RML-spe...
java
{ "resource": "" }
q162947
R2RMLManager.getJoinMappings
train
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 robm : pobm.getRef...
java
{ "resource": "" }
q162948
R2RMLManager.getMappingTripleAtoms
train
private ImmutableList<TargetAtom> getMappingTripleAtoms(TriplesMap tm) throws Exception { //the body to return ImmutableList.Builder<TargetAtom> bodyBuilder = ImmutableList.builder(); //get subject ImmutableTerm subjectAtom = r2rmlParser.getSubjectAtom(tm); //get any class predicates, construct atom Cla...
java
{ "resource": "" }
q162949
JDBCConnectionManager.createConnection
train
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; }
java
{ "resource": "" }
q162950
JDBCConnectionManager.getConnection
train
public Connection getConnection(String url, String username, String password) throws SQLException { boolean alive = isConnectionAlive(); if (!alive) { createConnection(url, username, password); } return connection; }
java
{ "resource": "" }
q162951
ClassifiedTBoxImpl.classify
train
static ClassifiedTBox classify(OntologyImpl.UnclassifiedOntologyTBox onto) { DefaultDirectedGraph<ObjectPropertyExpression, DefaultEdge> objectPropertyGraph = getObjectPropertyGraph(onto); EquivalencesDAGImpl<ObjectPropertyExpression> objectPropertyDAG = EquivalencesDAGImpl.getEquivalencesDAG(objectPropert...
java
{ "resource": "" }
q162952
ClassifiedTBoxImpl.getObjectPropertyGraph
train
private static DefaultDirectedGraph<ObjectPropertyExpression,DefaultEdge> getObjectPropertyGraph(OntologyImpl.UnclassifiedOntologyTBox ontology) { DefaultDirectedGraph<ObjectPropertyExpression,DefaultEdge> graph = new DefaultDirectedGraph<>(DefaultEdge.class); for (ObjectPropertyExpression role : ontology.objectP...
java
{ "resource": "" }
q162953
ClassifiedTBoxImpl.getDataPropertyGraph
train
private static DefaultDirectedGraph<DataPropertyExpression,DefaultEdge> getDataPropertyGraph(OntologyImpl.UnclassifiedOntologyTBox ontology) { DefaultDirectedGraph<DataPropertyExpression,DefaultEdge> graph = new DefaultDirectedGraph<>(DefaultEdge.class); for (DataPropertyExpression role : ontology.dataProperties(...
java
{ "resource": "" }
q162954
ClassifiedTBoxImpl.getClassGraph
train
private static DefaultDirectedGraph<ClassExpression,DefaultEdge> getClassGraph (OntologyImpl.UnclassifiedOntologyTBox ontology, DefaultDirectedGraph<ObjectPropertyExpression,DefaultEdge> objectPropertyGraph, DefaultDirectedGraph<DataPropertyExpression,DefaultEdge> dataPropertyG...
java
{ "resource": "" }
q162955
SQLDistinctTupleResultSet.moveCursor
train
@Override protected boolean moveCursor() throws SQLException, OntopConnectionException { boolean foundFreshRow; List<Object> currentKey; do{ foundFreshRow = rs.next(); // Cannot use this in the while condition: limit case where the last row was a duplicate if...
java
{ "resource": "" }
q162956
R2RMLParser.getClassPredicates
train
public List<ImmutableFunctionalTerm> getClassPredicates() { List<ImmutableFunctionalTerm> classes = new ArrayList<>(); for (ImmutableFunctionalTerm p : classPredicates) classes.add(p); classPredicates.clear(); return classes; }
java
{ "resource": "" }
q162957
R2RMLParser.getBodyURIPredicates
train
public List<ImmutableFunctionalTerm> getBodyURIPredicates(PredicateObjectMap pom) { List<ImmutableFunctionalTerm> predicateAtoms = new ArrayList<>(); // process PREDICATEMAP for (PredicateMap pm : pom.getPredicateMaps()) { String pmConstant = pm.getConstant().toString(); if (pmConstant != null) { Immu...
java
{ "resource": "" }
q162958
R2RMLParser.getTermTypeAtom
train
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 (type.equals(R2RML...
java
{ "resource": "" }
q162959
R2RMLParser.trim
train
private String trim(String string) { while (string.startsWith("\"") && string.endsWith("\"")) { string = string.substring(1, string.length() - 1); } return string; }
java
{ "resource": "" }
q162960
R2RMLParser.trimTo1
train
private String trimTo1(String string) { while (string.startsWith("\"\"") && string.endsWith("\"\"")) { string = string.substring(1, string.length() - 1); } return string; }
java
{ "resource": "" }
q162961
PushDownBooleanExpressionOptimizerImpl.pushDownExpressions
train
private IntermediateQuery pushDownExpressions(final IntermediateQuery initialQuery) { // Non-final Optional<QueryNode> optionalCurrentNode = initialQuery.getFirstChild(initialQuery.getRootNode()); // Non-final IntermediateQuery currentQuery = initialQuery; while (optionalCurren...
java
{ "resource": "" }
q162962
PushDownBooleanExpressionOptimizerImpl.optimizeJoinOrFilter
train
private NextNodeAndQuery optimizeJoinOrFilter(IntermediateQuery currentQuery, JoinOrFilterNode currentNode) { /** * Tries to build a PushDownBooleanExpressionProposal for the current node */ Optional<PushDownBooleanExpressionProposal> optionalProposal = makeProposal( c...
java
{ "resource": "" }
q162963
PushDownBooleanExpressionOptimizerImpl.buildProposal
train
private Optional<PushDownBooleanExpressionProposal> buildProposal( JoinOrFilterNode providerNode, ImmutableMultimap<Recipient, ImmutableExpression> recipientMap) { ImmutableCollection<Map.Entry<Recipient, ImmutableExpression>> recipientEntries = recipientMap.entries(); /* * Collect...
java
{ "resource": "" }
q162964
QueryInterfacePanel.updateStatus
train
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); } }
java
{ "resource": "" }
q162965
QueryInterfacePanel.showBooleanActionResultInTextInfo
train
public void showBooleanActionResultInTextInfo(String title, BooleanOWLResultSet result) throws OWLException { AskQueryInfoSetter alter_result_panel = new AskQueryInfoSetter(title, result); SwingUtilities.invokeLater(alter_result_panel); }
java
{ "resource": "" }
q162966
QueryInterfacePanel.tableChanged
train
@Override public void tableChanged(TableModelEvent e) { int rows = ((TableModel) e.getSource()).getRowCount(); updateStatus(rows); }
java
{ "resource": "" }
q162967
AbstractFunctionalTermImpl.containsTerm
train
@Override 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; }
java
{ "resource": "" }
q162968
ImmutableQueryModifiersImpl.extractModifierNodes
train
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(cor...
java
{ "resource": "" }
q162969
InnerJoinNodeImpl.liftChildBinding
train
private LiftingStepResults liftChildBinding(ImmutableList<IQTree> initialChildren, Optional<ImmutableExpression> initialJoiningCondition, VariableGenerator variableGenerator) throws EmptyIQException { ImmutableList<I...
java
{ "resource": "" }
q162970
QueryControllerTreeModel.synchronize
train
public void synchronize(List<QueryControllerEntity> queryEntities) { if (queryEntities.size() > 0) { for (QueryControllerEntity queryEntity : queryEntities) { if (queryEntity instanceof QueryControllerGroup) { QueryControllerGroup group = (QueryControllerGroup) queryEntity; QueryGroupTreeElement que...
java
{ "resource": "" }
q162971
QueryControllerTreeModel.reset
train
public void reset() { Enumeration<TreeNode> children = root.children(); while (children.hasMoreElements()) { removeNodeFromParent((MutableTreeNode) children.nextElement()); children = root.children(); } }
java
{ "resource": "" }
q162972
QueryControllerTreeModel.elementAdded
train
public void elementAdded(QueryControllerEntity element) { if (element instanceof QueryControllerGroup) { QueryControllerGroup group = (QueryControllerGroup) element; QueryGroupTreeElement ele = new QueryGroupTreeElement(group.getID()); insertNodeInto(ele, (DefaultMutableTreeNode) root, root.getChildCount());...
java
{ "resource": "" }
q162973
QueryControllerTreeModel.elementRemoved
train
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 (groups.hasMor...
java
{ "resource": "" }
q162974
QueryControllerTreeModel.getNode
train
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) { QueryGroupTreeElement groupTEle...
java
{ "resource": "" }
q162975
QueryControllerTreeModel.getElementQuery
train
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 QueryGroupTreeElement && cur...
java
{ "resource": "" }
q162976
QueryNodeNavigationTools.getDepthFirstNextNode
train
public static Optional<QueryNode> getDepthFirstNextNode(IntermediateQuery query, QueryNode currentNode) { return getDepthFirstNextNode(query, currentNode, false); }
java
{ "resource": "" }
q162977
QueryNodeNavigationTools.getNextNodeAndQuery
train
public static NextNodeAndQuery getNextNodeAndQuery(IntermediateQuery query, NodeCentricOptimizationResults<? extends QueryNode> results) { /** * If there is still a node at center: gets the next one of it */ Optional<? extends Que...
java
{ "resource": "" }
q162978
BasicQueryTreePrinter.stringifySubTree
train
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.ap...
java
{ "resource": "" }
q162979
ImmutableSubstitutionTools.prioritizeRenaming
train
public <T extends ImmutableTerm> ImmutableSubstitution<T> prioritizeRenaming( ImmutableSubstitution<T> substitution, ImmutableSet<Variable> priorityVariables) { ImmutableMultimap<Variable, Variable> renamingMultimap = substitution.getImmutableMap().entrySet().stream() .filter(e -> p...
java
{ "resource": "" }
q162980
ImmutableUnificationTools.computeDirectedMGU
train
public Optional<ImmutableSubstitution<ImmutableTerm>> computeDirectedMGU(ImmutableTerm sourceTerm, ImmutableTerm targetTerm) { /* * Variable */ if (sourceTerm instanceof Variable) { Variable...
java
{ "resource": "" }
q162981
OldSyntaxMappingConverter.readSourceDeclaration
train
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); ...
java
{ "resource": "" }
q162982
SWRLVisitor.createDatalog
train
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); errors.cl...
java
{ "resource": "" }
q162983
SWRLVisitor.createDatalog
train
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; }
java
{ "resource": "" }
q162984
SWRLVisitor.visit
train
@Override public void visit(SWRLDataRangeAtom node) { notSupported=true; errors.add(node.toString()); }
java
{ "resource": "" }
q162985
LooseFDRedundantSelfJoinExecutor.selectNodesToRemove
train
private ImmutableSet<ExtensionalDataNode> selectNodesToRemove( ImmutableSet<Variable> requiredAndCooccuringVariables, ImmutableMap<FunctionalDependency, ImmutableCollection<Collection<ExtensionalDataNode>>> constraintNodeMap, AtomPredicate predicate) { if (settings.getCardinalityPreser...
java
{ "resource": "" }
q162986
LeftToInnerJoinExecutor.extractEqualities
train
private Stream<ImmutableExpression> extractEqualities(ImmutableSubstitution<ImmutableTerm> substitution, ImmutableSet<Variable> leftVariables) { return substitution.getImmutableMap().entrySet().stream() .filter(e -> leftVariables.contains...
java
{ "resource": "" }
q162987
LeftToInnerJoinExecutor.liftSubstitution
train
private LeftJoinNode liftSubstitution(LeftJoinNode normalizedLeftJoin, ImmutableSubstitution<ImmutableTerm> remainingRightSubstitution, IntermediateQuery query) { SubstitutionPropagationProposal<LeftJoinNode> proposal = new Subs...
java
{ "resource": "" }
q162988
SQLQueryPainter.recolorQuery
train
public void recolorQuery() { String input = parent.getText(); resetStyles(); doc.setCharacterAttributes(0, doc.getLength(), plainStyle, true); // Locating all SELECTS input = input.replaceAll("[Ss][Ee][Ll][Ee][Cc][Tt]", "SELECT"); int offset = 0; for (int index = input.indexOf("SELECT", offset); index !...
java
{ "resource": "" }
q162989
JoinLikeNodeImpl.liftRegularChildBinding
train
protected <R> R liftRegularChildBinding(ConstructionNode selectedChildConstructionNode, int selectedChildPosition, IQTree selectedGrandChild, ImmutableList<IQTree> children, ...
java
{ "resource": "" }
q162990
QuestQueryProcessor.getRewritingRendering
train
@Override public String getRewritingRendering(InputQuery query) throws OntopReformulationException { InternalSparqlQuery translation = query.translate(inputQueryTranslator); try { IQ converetedIQ = preProcess(translation); IQ rewrittenIQ = rewriter.rewrite(converetedIQ); return rewrittenIQ.toStri...
java
{ "resource": "" }
q162991
QueryController.createGroup
train
public void createGroup(String groupId) throws Exception { if (getElementPosition(groupId) == -1) { QueryControllerGroup group = new QueryControllerGroup(groupId); entities.add(group); fireElementAdded(group); } else { throw new Exception("The name is already taken, either by a query group or a query ...
java
{ "resource": "" }
q162992
QueryController.getGroup
train
public QueryControllerGroup getGroup(String groupId) { int index = getElementPosition(groupId); if (index == -1) { return null; } QueryControllerGroup group = (QueryControllerGroup) entities.get(index); return group; }
java
{ "resource": "" }
q162993
QueryController.getGroups
train
public List<QueryControllerGroup> getGroups() { List<QueryControllerGroup> groups = new ArrayList<QueryControllerGroup>(); for (QueryControllerEntity element : entities) { if (element instanceof QueryControllerGroup) { groups.add((QueryControllerGroup) element); } } return groups; }
java
{ "resource": "" }
q162994
QueryController.removeGroup
train
public void removeGroup(String groupId) { for (Iterator<QueryControllerEntity> iterator = entities.iterator(); iterator.hasNext();) { Object temporal = iterator.next(); if (!(temporal instanceof QueryControllerGroup)) { continue; } QueryControllerGroup element = (QueryControllerGroup) temporal; if ...
java
{ "resource": "" }
q162995
QueryController.addQuery
train
public QueryControllerQuery addQuery(String queryStr, String queryId) { int position = getElementPosition(queryId); QueryControllerQuery query = new QueryControllerQuery(queryId); query.setQuery(queryStr); if (position == -1) { // add to the collection for a new query. entities.add(query); fireElementAd...
java
{ "resource": "" }
q162996
QueryController.addQuery
train
public QueryControllerQuery addQuery(String queryStr, String queryId, String groupId) { int position = getElementPosition(queryId); QueryControllerQuery query = new QueryControllerQuery(queryId); query.setQuery(queryStr); QueryControllerGroup group = getGroup(groupId); if (group == null) { group = new ...
java
{ "resource": "" }
q162997
QueryController.removeAllQueriesAndGroups
train
public void removeAllQueriesAndGroups() { List<QueryControllerEntity> elements = getElements(); for (QueryControllerEntity treeElement : elements) { fireElementRemoved(treeElement); } entities.clear(); }
java
{ "resource": "" }
q162998
QueryController.removeQuery
train
public void removeQuery(String id) { int index = getElementPosition(id); QueryControllerEntity element = entities.get(index); if (element instanceof QueryControllerQuery) { entities.remove(index); fireElementRemoved(element); return; } else { QueryControllerGroup group = (QueryControllerGroup) elem...
java
{ "resource": "" }
q162999
QueryController.getElementPosition
train
public int getElementPosition(String element_id) { int index = -1; for (int i = 0; i < entities.size(); i++) { QueryControllerEntity element = entities.get(i); if (element instanceof QueryControllerQuery) { QueryControllerQuery query = (QueryControllerQuery) element; if (query.getID().equals(element_...
java
{ "resource": "" }