<commit_before>package com.getbase.android.autoprovider;

import com.getbase.android.db.fluentsqlite.Delete;
import com.getbase.android.db.fluentsqlite.Insert;
import com.getbase.android.db.fluentsqlite.QueryBuilder.Query;
import com.getbase.android.db.fluentsqlite.Update;
import com.getbase.autoindexer.DbTableModel;
import com.getbase.forger.thneed.MicroOrmModel;

import org.chalup.thneed.ModelGraph;

import android.content.ContentValues;
import android.net.Uri;

public class AutoProvider<TModel extends DbTableModel & MicroOrmModel> {
  private final AutoUris<TModel> mAutoUris;
  private final ContentTypeVisitor mContentTypeVisitor;
  private final QueryBuilderVisitor mQueryBuilderVisitor;

  public AutoProvider(AutoUris<TModel> autoUris, ModelGraph<TModel> modelGraph) {
    mAutoUris = autoUris;

    mContentTypeVisitor = new ContentTypeVisitor(mAutoUris.getAuthority());
    mQueryBuilderVisitor = new QueryBuilderVisitor(modelGraph);
  }

  private AutoUri getAutoUri(Uri uri) {
    return mAutoUris.getAutoUri(uri).get();
  }

  public String getType(Uri uri) {
    return getAutoUri(uri).accept(mContentTypeVisitor);
  }

  public Query query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    return getAutoUri(uri).accept(mQueryBuilderVisitor)
        .columns(projection)
        .where(selection, selectionArgs)
        .orderBy(sortOrder);
  }

  public Insert insert(Uri uri, ContentValues values) {
    return null;
  }

  public Delete delete(Uri uri, String selection, String[] selectionArgs) {
    return null;
  }

  public Update update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
    return null;
  }
}
<commit_msg>How to treat relations in Entity/Model uris for CRUD operations (select vs. contentvalues)<commit_after>package com.getbase.android.autoprovider;

import com.getbase.android.db.fluentsqlite.Delete;
import com.getbase.android.db.fluentsqlite.Insert;
import com.getbase.android.db.fluentsqlite.QueryBuilder.Query;
import com.getbase.android.db.fluentsqlite.Update;
import com.getbase.autoindexer.DbTableModel;
import com.getbase.forger.thneed.MicroOrmModel;

import org.chalup.thneed.ModelGraph;

import android.content.ContentValues;
import android.net.Uri;

public class AutoProvider<TModel extends DbTableModel & MicroOrmModel> {
  private final AutoUris<TModel> mAutoUris;
  private final ContentTypeVisitor mContentTypeVisitor;
  private final QueryBuilderVisitor mQueryBuilderVisitor;

  public AutoProvider(AutoUris<TModel> autoUris, ModelGraph<TModel> modelGraph) {
    mAutoUris = autoUris;

    mContentTypeVisitor = new ContentTypeVisitor(mAutoUris.getAuthority());
    mQueryBuilderVisitor = new QueryBuilderVisitor(modelGraph);
  }

  private AutoUri getAutoUri(Uri uri) {
    return mAutoUris.getAutoUri(uri).get();
  }

  public String getType(Uri uri) {
    return getAutoUri(uri).accept(mContentTypeVisitor);
  }

  public Query query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    return getAutoUri(uri).accept(mQueryBuilderVisitor)
        .columns(projection)
        .where(selection, selectionArgs)
        .orderBy(sortOrder);
  }

  public Insert insert(Uri uri, ContentValues values) {
    return null;
  }

  public Delete delete(Uri uri, String selection, String[] selectionArgs) {
    return null;
  }

  public Update update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
    return null;
  }

  //    E   M
  // R  S   S
  // C  -   CV
  // U  S   S
  // D  S   S
}

{'fraction_non_alphanumeric': 0.09156693570832174, 'fraction_numerical': 0.0, 'mean_word_length': 4.624413145539906, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4441088', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1086, 'n_words': 247}