What's a RDF triple?

前端 未结 14 1732
南笙
南笙 2020-12-04 15:39

In layman\'s terms, what\'s a RDF triple?

相关标签:
14条回答
  • 2020-12-04 15:39

    It has been awhile since I worked with RDF, but here it goes :D

    A triple is a subject, predicate and object.

    The subject is a URI which uniquely identifies something. For example, your openid uniquely identifies you.

    The object defines how the subject and object are related.

    The predicate is some attribute of the subject. For example a name.

    Given that, the triples form a graph S->P. Given more triplets, the graph grows. For example, you can have the same person identified as the subject of a bunch of triples, you can then connect all of the predicates through that unique subject.

    0 讨论(0)
  • 2020-12-04 15:41

    I'm going to have to agree with A Pa in part, even though he was down-voted.

    Background: I'm a linguist, with a PhD in that subject, and I work in computational linguistics.

    The statement that "...a sentence that consists of three parts: subject, predicate, object. Basically, this is the fundamental structure of natural language speech" (which A Pa quotes from Kingsley Uyi Idehen's answer) is simply wrong. And it's not just that Kingsley says this, I've heard it from many advocates of RDF triples.

    It's wrong for many reasons, for example: Predicates (in English, arguably, and in many other natural languages) consist of a verb (or a verb-like thing) + the object (and perhaps other complements). It is definitely NOT the case that the syntactic structure of English is Subj-Pred-Obj.

    Furthermore, not all natural language sentences in English have an object; intransitive verbs, in particular, by definition do not take objects. And weather verbs (among other things) don't even take a "real" subject (the "it" of "it rains" has no reference). And on the other hand, ditransitive verbs like "give" take both a direct and an indirect object. Then there are verbs like "put" that take a locative in addition to the direct object, or "tell" that take an object and a clause. Not to mention adjuncts, like time and manner adverbials.

    Yes, of course you can represent embedded clauses as embedded triples (to the extent that you can represent any statement as triples, which as I hope you've made clear, you can't), but what I don't think you can do in RDF (at least I've never seen it done, and it seems like it would take a quadruple) is to have both an object and an embedded clause. Likewise both a direct and an indirect object, or adjuncts.

    So whatever the motivation for RDF triples, I wish the advocates would stop pretending that there's a linguistic motivation, or that the triples in any way resemble natural language syntax. Because they don't.

    0 讨论(0)
  • 2020-12-04 15:42

    An RDF Triple is a statement which relates one object to another. For Example:

    "gcc" "Compiles" "c" .
    "gcc" "compiles" "Java" . 
    "gcc" "compiles" "fortran" .
    "gcc" "has a website at" <http://gcc.gnu.org/> .
    "gcc" "has a mailing list at" <mailto:gcc-help@gcc.gnu.org> .
    "c" "is a" "programming language" .
    "c" "is documented in" <http://www.amazon.com/Programming-Language-Prentice-Hall-Software/dp/0131103628/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1226085111&sr=8-1> .
    
    0 讨论(0)
  • 2020-12-04 15:44

    Regarding the answer by Adam N. I believe the O.P. asked a previous question regarding data for a social network, so although the answer is excellent, I will just clarify in relation to the "original original" question. (As I feel responsible).

        John | Is a Friend of | James
        James | Is a friend of | Jill
        Jill | Likes | Snowboarding
        Snowboarding | Is a | Sport
    

    Using triples like this you can have a really flexible data structure.

    Look at the Friend of a friend (FOAF) perhaps for a better example.

    0 讨论(0)
  • 2020-12-04 15:45

    See: http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-rdf-triple

    An RDF triple contains three components:

    • the subject, which is an RDF URI reference or a blank node
    • the predicate, which is an RDF URI reference
    • the object, which is an RDF URI reference, a literal or a blank node

    where literals are essentially strings with optional language tags, and blank nodes are also strings. URIs, literals and blank nodes must be from pair-wise disjoint sets.

    0 讨论(0)
  • 2020-12-04 15:47

    As a developer, I have struggled for a while until I finally understood what RDF and its tripes was about, mostly because I have always seen the world through code and not through data.

    Given this is posted on StackOverflow, here is the Java analogy that finally made it click for me: a RDF triple is to data what a class' method/parameter is to code.

    So:

    • A class with its package name is the Subject
    • A method on this class is the Predicate
    • Parameter(s) on the method is the Object, which are themselves represented by classes
    • Contexts are import statements to avoid writing the full canonical name of classes

    The only point where this analogy breaks down a bit is that Predicates also have namespaces, while methods do not. But the overall relationships created between class instances as Subject and Object when a Predicate is used reflects on the idea of calling a method to do something.

    Basically, RDF is to data what OO is to code.

    0 讨论(0)
提交回复
热议问题