https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/AdditionalChapters/Introduction.html#//apple_ref/doc/uid/TP40001789

Predicates provide a general means of specifying queries in Cocoa. The predicate system is capable of handling a large number of domains, including Core Data and Spotlight. This document describes predicates in general, their use, their syntax, and their limitations.

At a Glance

In Cocoa, a predicate is a logical statement that evaluates to a Boolean value (true or false). There are two types of predicate, known as comparison and compound:

  • comparison predicate compares two expressions using an operator. The expressions are referred to as the left hand side and the right hand side of the predicate (with the operator in the middle). A comparison predicate returns the result of invoking the operator with the results of evaluating the expressions.

  • compound predicate compares the results of evaluating two or more other predicates, or negates another predicate.

Cocoa supports a wide range of types of predicate, including the following:

  • Simple comparisons, such as grade == 7 or firstName like 'Mark'

  • Case or diacritic insensitive lookups, such as name contains[cd] 'citroen'

  • Logical operations, such as (firstName beginswith 'M') AND (lastName like 'Adderley')

You can also create predicates for relationships—such as group.name matches 'work.*'ALL children.age > 12, and ANY children.age > 12—and for operations such as @sum.items.price < 1000.

Cocoa predicates provide a means of encoding queries in a manner that is independent of the store used to hold the data being searched. You use predicates to represent logical conditions used for constraining the set of objects retrieved by Spotlight and Core Data, and for in-memory filtering of objects.

You can use predicates with any class of object, but a class must be key-value coding compliant for the keys you want to use in a predicate.

Predicate Programming Guide的更多相关文章

  1. 【IOS笔记】View Programming Guide for iOS -1

    原文:View Programming Guide for iOS View and Window Architecture Views and windows present your applic ...

  2. Quartz 2D Programming Guide

    Quartz 2D Programming  Guide 官方文档: Quartz 2D Programming Guide 译文: Quartz 2D编程指南(1) - 概览 Quartz 2D编程 ...

  3. [IoLanguage]Io Programming Guide[转]

    Io Programming Guide     Introduction Perspective Getting Started Downloading Installing Binaries Ru ...

  4. Structured Streaming Programming Guide结构化流编程指南

    目录 Overview Quick Example Programming Model Basic Concepts Handling Event-time and Late Data Fault T ...

  5. GraphX学习笔记——Programming Guide

    学习的资料是官网的Programming Guide https://spark.apache.org/docs/latest/graphx-programming-guide.html 首先是Gra ...

  6. View Programming Guide for iOS_读书笔记[正在更新……]

    原文:View Programming Guide for iOS 1 Introduction 先熟悉一下基本概念. Window Windows do not have any visible c ...

  7. OpenGL® ES 3.0 Programming Guide - Book Website

    OpenGL® ES 3.0 Programming Guide - Book Website http://opengles-book.com sample codes in GitHub: htt ...

  8. 对Spark2.2.0文档的学习3-Spark Programming Guide

    Spark Programming Guide Link:http://spark.apache.org/docs/2.2.0/rdd-programming-guide.html 每个Spark A ...

  9. Spark Streaming Programming Guide

    参考,http://spark.incubator.apache.org/docs/latest/streaming-programming-guide.html Overview SparkStre ...

随机推荐

  1. Java socket异常

    Java socket异常 分类: Java 2013-07-15 22:38 981人阅读 评论(0) 收藏 举报 目录(?)[+] 使用Java socket编写程序时,通常会遇到几种种异常:Bi ...

  2. Kth Largest Element in a Stream

    Design a class to find the kth largest element in a stream. Note that it is the kth largest element ...

  3. ue4 renderTexture简单记录

    示例内容中的renderTexture 抓取部分 1 新建一个TextureRenderTarget2D 2 抓图 新建actor,一个camera,下面挂一个SceneCaptureComponen ...

  4. unreal4特性介绍

    原文地址:   https://www.unrealengine.com/products/unreal-engine-4     unreal enginer介绍 我的UE4学习(一) 你曾想过用连 ...

  5. hdu2612(dijkstra)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2612 题意:给出一个n*m的矩阵,' . ' 表示可以走的路, ' # '表示不能走的路 ,’ @'表 ...

  6. AGC001 D - Arrays and Palindrome【构造】

    把回文串的相等关系连一下,发现最后要求的是一笔画问题 注意到奇数长度的中间有一个单独没有连线的,所以a数组至多有两个奇数值 如果没有奇数,那么b在最前面放一个1,然后把a[1]~a[m-1]放上去,这 ...

  7. nodejs ejs 引擎脱离express使用

    之前用ejs都是使用express创建项目,然后在app.js中配置好的ejs直接使用即可,但是最近项目中使用的手工路由模式,脱离了express,不知道怎么用了,去扒ejs的网站,各种资料,也是懵懵 ...

  8. Java反射机制调用对象的方法 —— 将一个对象的属性值赋值给另一个对象的属性

    模拟一个场景: 众所周知,EasyExcel导出Excel文档是依赖于注解完成的,在实体类需要导出的属性上面加上注解,导出的时候会自动识别该属性. 假如我们现在需要导出用户的信息,又不想污染原本的实体 ...

  9. Python模块之 sys

    # sys模块是与python解释器交互的一个接口 import sys print(sys.argv) # 命令行参数list,第一个元素是程序本身路径 # (第一个元素就是执行文件的时候,写在py ...

  10. Python 开发基础-字符串类型讲解(字符串方法)-1

    s = 'Hello World!' print(s.capitalize()) #第一个字母大写,其余小写# 输出:Hello world!print(s.swapcase())#大写变小写,小写变 ...