In the case of RDF data query or description, SPARQL whether from birth, standard or operating habits are a good choice, but for a beginner more or less "taboo" means, operation is a bit timid, so just use this time to summarize and learn language, The language features are one by one cracked. Simple query 1, general formula (basic key) select? o where{s p? o} Break: Class SQL is the choice of mapping, and SPARQL itself based on the ternary group in RDF (s P O)-the main predicate, all the query becomes the main predicate of the description, at the same time, the return of a variable, the value of the variable with a question mark? To represent, select to map. Formula: There is a definition can be used, there are definitions can be selected, all methods can be described as the composition of the ternary group, equivalent to using ternary knowledge to answer some questions. 2, Broken Sword Type (inclusive) Select O1 o2where{? s p1? O1. ? s p2? O2} Break: Inclusive, guided by the general decision, for the various variables or parameters can be related to the properties of the associated operation and display, can be the main principal association, the main object association and so on (the main predicate, predicate, many times are not homogeneous so may not be related), at the same time can have several properties, several iterations , thus forming an unpredictable query. The formula: According to the variable, according to the semantic understanding, the variable is the appropriate name, equivalent to a number of steps, a number of reasoning work. 3. Broken knife type (with light weight) select? s p where {? s? P X} Break method: With light weight, with fast enemy slow, unlike the previous variable, at this time the object is not fixed value, this fixed value may be a string, a number or IRI address, but also provides some basic formats such as @en and other language description, Use this method to implement a query against a property by knowing that the derivation is unknown. Formulas: Write according to RDF type and attributes, for special use See Label method, which is equivalent to using a label that does not enter the system to answer a question in the system. 4. Broken air type (with one heart) select? s owhere {s P O} Break method: The use of the good, the heart, and the general decision and other forms similar, but the broken things have subtle differences, specifically for the absence of a real subject or an anonymous subject, The return result may be just a random name in the field. Formula: Nameless is also famous, Kana is also true name, equivalent to using a placeholder to represent the corresponding space.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
SPARQL Language Model (i)