Presentation is loading. Please wait.

Presentation is loading. Please wait.

Part II. Reification We can make statements about the RDF statements themselves. This can be used to annotate information In science, it is common to.

Similar presentations


Presentation on theme: "Part II. Reification We can make statements about the RDF statements themselves. This can be used to annotate information In science, it is common to."— Presentation transcript:

1 Part II

2 Reification We can make statements about the RDF statements themselves. This can be used to annotate information In science, it is common to quote someone, or provide provenance or date stamp information, like who conducted certain experiment or simulation, and when it was done Explicit reification, which is used in database modeling, is also used in RDF to write more sophisticated statements about other statements using built-in vocabulary This is done by first making a reified model of the statement, with type, subject, predicate, and object properties We make a new resource to represent the entire statement

3 RDF Reification vocabulary Reification is done in RDF by using the following qualified names to annotate the statement: rdf : Statement (resources that are statement), and rdf : subject, rdf : predicate, and rdf : object properties For example, if we want to say that “Bill Fritz says that Dinwoody Formation formed in the Triassic”, we do it by first assigning a qualified name to the statement, such as q : n1, and then use it in the reification quad statements: q : n1rdf : typerdf : Statement; rdf : subjectstrat : Dinwoody; rdf : predicatestrat : formed-in; rdf : objecttime : Triassic. Person : Bill Fritzs : saysq : n1 i.e., the statement q, which is an rdf statement, the subject, predicate, and objects of which are given by the three qualified names, and that Dr. Fritz made this statement. This statement is using a bnode.

4 rdf : type time : Triassic strat : Dinwoody rdf : subject rdf : Statement rdf : object rdf : predicate Bill Fritz says strat : formed-in attributed-to

5 Alternative way to reify it Bill Fritz says that Dinwoody Formation formed in the Triassic FritzsaysS Srdf:typerdfs:Statement Srdf:subjectDinwoodyFormation Srdf:predicateformedIn Srdf:objectTriassic

6 SPARQL SPARQL (pronounced sparkle) is the standard RDF query language SPARQL uses variables for the subject, predicate, and object of an RDF triple The queries are made of parts called ’triple pattern”, which has variables represented by a letter preceded by a question mark (?), e.g., ?x.

7 SPARQL Queries, Example Which epoch precedes Miocene (Oligocene) ?xtime : precedestime : Miocene. Which minerals are part-of granite (quartz, feldspars, micas) petr : Mineral?ypetr : Granite. Pollutant pollute which aquifer? hydro : Pollutant hydro : pollute ?z. The SPARQL engine needs the ontologies (in this case, Time, Petrology, and Hydrogeology) to return the associated responses to these queries

8 Graph Pattern Query A graph pattern query (given within {} braces) is the one with a set of triple patterns. For example the following two triples: Which orogeny deformed (tect: namespace) the Tertiary system (strat: namespace)? Zagros orogeny (tect: namespace) formed (strat: namespace) which mountain range? The set of two triples are given in N3 as: {?orogenytect : deformedstrat : TertiarySystem tect : ZagrosOrogenystruc : formed?MtRange} For these queries to work, all the triple patterns must match the nodes and edges of the ontologies in these namespaces!

9 Inferencing The Semantic Web languages allow explicit expression of the relationship between classes of objects strat: Triassic partOf strat: Mesozoic Compared to databases, which require programming to drive data from complex hierarchical structures, these languages allow smarter integration and connection of data, making it easier to query and use the data

10 What is Inferencing? The Semantic Web languages provide ‘inferencing’, meaning that we can derive other related [unstated] information from a set of stated information The mechanisms for inference are provided in the language constructs, like rdfs:subclassOf, which make ‘inference-based semantics’ possible Through inferencing, we should be able to query a broader (general) term (e.g., Fault Rock) and get information about their narrower (specialized) subclass terms that extend it, e.g., MylonitesubClassOfFaultRock If we know FaultRock isA Rock, and Rock is Solid, and Solid isNot Liquid, then we can infer that Mylonite is Solid, and Mylonite isNot liquid. Note: isNot is modeled by saying that Liquid disjointWith Solid

11 … The Web Ontology Language (OWL) provides formal meaning to its constructs such as rdfs: Class and rdfs : subClassOf It is inferred from the language that: if C is a subClassOf C’, then every member x of class C is also a member of class C’ For example, if the Idaho batholith is a Batholith, and Batholith rdfs: subClassOf IgneousBody, then IdahoBatholiths rdfs:subclassOf IgneousBody So, if we search for igneous bodies in general, we may be offered information about the narrower Batholith term, and data about the Idaho batholiths may be provided C C’ y x

12 Type Propagation Rule The ‘type propagation rule’ gives the definition of the meaning of the C subClassOf C’ statement: IF ?C rdfs : subClassOf ?C’. AND ?x rdf : type ?C. THEN ?xrdf :type?C’. if C isA C’, and x is an instance of C, then x is an instance of C’. C C’ y x

13 Example for inference If all porphyritic textures are igneous texture, and all igneous textures are texture, and the individual texture1 is porphyritic: Applying predicate logic: If x is porphyritic texture, then x is igneous texture PorphyriticTexture (x)  IgneousTexture (x) If x is igneous texture, then x is texture IgneousTexture (x)  Texture (x) Given the following two instances: IgneousTexture (IgneousTexture1) and PorphyriticTexture (PorphyriticTexture1) Then we infer the following unasserted facts: IgneousTexture (PorphyriticTexture1) Texture (IgneousTexture1) Texture (PorphyriticTexture1) Texture IgneousTexture PorphyriticTexture1 PorphyriticTexture IgneousTexture1

14 Multiple Subclassing The Web Ontology Language (OWL), and its sub-languages (RDF and RDFS), provide formal constraint for the meaning of their constructs to make inferencing from combinations of terms possible Like object-oriented programming (OOP) languages, multiple subclassing (inheritance) exists in RDFS If A subClassOf B and A subClassOf C, then if x is an instance (individual) of A, then x is instances of both B and C (which follows from the type propagation rule) BC A x BrittleDuctile Semibrittle x

15 Benefits of Inference Rules This inference-based semantics is very powerful for the integration of heterogeneous data provided from autonomous, distributed sources on the Web, and making the distributed data useful The reason why inference rules make data, which are constrained by the OWL constructs, more useful, is that RDFS and OWL inferencing query engines, that know OWL inference rules, will infer (during a query) unasserted information from the directly asserted triples in the RDF store

16 Assume the triple store contains two asserted RDF triples struc : FaultRockrdfs : subClassOfpetr : Rock struc : Myloniterdf : typestruc : FaultRock Suppose the following SPARQL code queries the triple store, and wants to find out about things that are of type Rock, which is defined in the ‘petr’ namespace ?xrdf : typepetr : Rock. Despite the fact that there is no triple for the struc:Mylonite subject, with predicate rdf:type and object petr:Rock in the above asserted triples, the query will return (in addition to the started ?x = struc : FaultRock) the following inferred result using the rdfs inference query engine: ?x = struc : Mylonite Rock FaultRock Mylonite

17 Inferred Triples Inference engines, applying their set of inference rules return unasserted, inferred triples from asserted triples The inferred triples may or may not be saved in the triple store, and may be generated only at the time of querying

18 Example The following diagram shows the hierarchy of the pyroxene minerals in the min : Mineralogy ontology This means that Diopside isA Pyroxene, and Pyroxene isA Silicate, and Silicate isA Mineral

19 Inferred Triples Given the following asserted triples: min : Diopside rdf : type min : Pyroxene min : Pyroxene rdf : typemin : Silicate min : Silicate rdf : typemin : Mineral We can derive the following inferred triples using the type propagation rule on the asserted triples: min : pyroxenerdf : type min : Mineral min : diopside rdf : type min : Silicate min : diopside rdf : type min : Mineral

20 RDF and Relational Database Every statement in RDF is like a value in a cell of a database table which requires three values for its complete representation: Table a row identifier (subject, s ) a column identifier (predicate, p ) the value in each table cell (object, o ) Note: for a 3x3 table, we have 9 triples! Recall that we refer to the ‘subject-predicate-object’ statement as a ‘triple’ p so

21 Triples: Building blocks for RDF Subject (S) is the thing for which we are making the statement. In this case it is the record, i.e., row Predicate (P) is the property for the subject entity in the row In this case it is the column or field Object (O) is the value for the property at the cell p so

22 Data Federation RDF is designed for data federation of any kind (database, spreadsheet, XML), originated from multiple sources These data can be converted into a set of triples and put in the RDF data store (federated graph), ready to be queried In the RDF triple: ‘Course instructor Babaie’, course is the subject, instructor is the predicate, and Babaie is the value for the instructor: CourseBabaie instructor SubjectObjectPredicate

23 Directed Graph An RDF store commonly has more than one triple referring to the same subject (S), i.e., 1 s, many o’s The picture is shown for one row only! This translates to one row, (i.e., record) of a relational database table with multiple fields (columns) This leads to the ‘directed graph’, which shows triples as ‘edges’ (labeled by predicates) radiating from one subject ‘node‘ to different object nodes p1p1 p 2 p 3 so1o1 o2o2 o3o3 so2o2 o3o3 o1o1 p1p1 p3p3 p2p2

24 takes lithology purpose type sampleIDlithologytypepurpose N235 basalt powder K-Ar dating N300 granite chip thin section basalt K-Ar dating powder SampleID N235 Investigator Sample Table Directed Graph only shown for N235 S1 S2 p1p2p3

25 URI (Uniform Resource Identifier) Merging a distributed group of directed groups requires mapping nodes in each graph Even if nodes in different graphs have the same name, it is not guaranteed that the nodes are from the same resource! To make matching of the nodes possible, we need to use the URI (Uniform Resource Identifier), which is a superclass of the URL (every URL is a URI, but not the other around). A URI is a global identifier for a resource (has information about server name, protocol, port number, file name) which is required for a global networking URI refers to either a Web name or a location, compared to the URL which only refers to a Web location

26 URI Prefix Nodes from two graphs can be merged if they have the same URI We use a prefix to represent the long URI strings, e.g., ‘geochem’ and ‘struc’ can represent the Geochemistry and structural geology prefixes which may have a URI: http://www.usgs.org/ontologies/Geochemistry.owl# http://www.usgs.org/ontologies/StructuralGeology.owl# If the Geochemistry or Structural Geology ontology has a class called Analysis or Foliation, respectively, we designate them as: geochem : Analysis struc : Foliation

27 Default Namespace If there is only one (default) namespace, we show the class name with a colon followed by the class name (e.g., : Fracture). OWL, RDF, RDFS, and XSD have their own standard namespace Thus, rdf : type is a typing construct in the rdf namespace. Here are some more: struc : Foldrdf : typestruc : Structure geochem : oxidizerdf : typerdf : Property

28 Relational database tables and RDF Rows in a relational table represent a single record Each record maps to an individual entity This means that each row should have a unique URI, which in the database is represented by the unique identifier (ID column, the primary key) IDp1p1 p2p2 p3p3 s1s1 o 11 o 12 o 13 s2s2 o 21 o 22 o 23 Record

29 Relational Database to RDF Graph The best practice is to design a URI for the table, with a prefix: xmlns : geochem = http://www.gsi.ir/ontologies/geochemistry.owl#Sample We identify each row by concatenating the table name (Sample) with the ID of each row, for example, geochem : Sample1, geochem : Sample2, etc. To make the fields also unique, we concatenate the table name ( Sample ) with the column name, like: geochem : Sample_lithology, geochem : Sample_type, geochem : Sample_purpose IDlithologytypepurpose 1 2 Geochem : Sample

30 Example for RDB to RDF Notice that, during conversion of a relational table to RDF, each cell in the table converts into one RDF triple In the table in the next slide, we have: 7 rows and 5 columns, which lead to 35 triples Note: Only triples for two samples are shown!

31 IDnumberlocationanalysislithology 1N122 Neyriz REEGabbro 2N150NeyrizTrace elementPyroxenite 3Z338ZabolPb IsotopeBasalt 4R120RashtSr IsotopeGranite 5S214SabzevarXRDGabbro 6R123RashtXRDGranite 7S220SabzevarMajor oxidesDunite Geochem : Sample Geochem:Sample Number Geochem:Sample1 Geochem:Sample2 Geochem:Sample location Geochem:Sample analysis Geochem:Sample lithology Geochem:Sample3 Geochem:Sample4 Geochem:Sample5 Geochem:Sample6 Geochem:Sample7

32 Relational database (RDB) to RDF Fields (columns) of the table become properties (predicate): geochem : Sample_number geochem : Sample_location etc. Each row provides the subject, for example, geochem : Sample1 geochem : Sample2 etc. The following table shows part of the RDF graph of the previous Sample table in the Geochemistry database:

33 SubjectPredicateObject geochem : Sample1geochem : sampleId1 geochem : Sample1geochem : sampleNumberN122 geochem : Sample1geochem : sampleLocationNeyriz geochem : Sample1geochem : sampleAnaysisREE geochem : Sample1geochem : sampleLithologyGabbro geochem : Sample2geochem : sampleId2 geochem : Sample2geochem : sampleNumberN150 geochem : Sample2geochem : sampleLocationNeyriz geochem : Sample2geochem : sampleAnalysisTrace Element geochem : Sample2geochem : sampleLithologyPyroxenite ……… RDF triples for the Sample table in the Geochemistry database (only 2 samples shown!)

34 In this case, the objects are not class (object) resources. Here they are literal values (i.e., string). The type for each individual (i.e., each row) is the table (in this case, Sample). These types are also given in the RDF graph. SubjectPredicateObject geochem : Sample1rdfs : typegeochem : Sample geochem : Sample2rdfs : typegeochem : Sample geochem : Sample3rdfs : typegeochem : Sample geochem : Sample4rdfs : typegeochem : Sample geochem : Sample5rdfs : typegeochem : Sample geochem : Sample6rdfs : typegeochem : Sample geochem : Sample7rdfs : typegeochem : Sample


Download ppt "Part II. Reification We can make statements about the RDF statements themselves. This can be used to annotate information In science, it is common to."

Similar presentations


Ads by Google