160 likes | 391 Views
Namespaces. … and ontologies. Namespaces. The goal is to ensure that domains with similar characteristics use a shared vocabulary as much as possible XML supports and explicit notion of a namespace Namespaces can be scoped using XML element nesting. Example from Bernstein et al book.
E N D
Namespaces … and ontologies
Namespaces • The goal is to ensure that domains with similar characteristics use a shared vocabulary as much as possible • XML supports and explicit notion of a namespace • Namespaces can be scoped using XML element nesting
Kinds of namespaces • Namespaces for XML technology itself, including XML and XML Schema • targetNamespace: for the domain-specific tags that appear in your XML code
Dealing with ambiguity • We can use a prefix to specify the namespace we are referring to
How namespaces are specified • A list of terms and definitions • A list of elements and attributes in an XML language • Such as the XSLT namespace • A hierarchical set of terms • Such as the Dublin Core
Programmers use namespaces • Before writing code for a new application, programmers often define a new namespace or augment one. • An example: C++ namespace: classes, objects, functions • Without: • With:
Example: Biomodels • BioModels Database is a free and open-source database for storing, exchanging and retrieving published quantitative models of biological interest. • Example: • hasPart • The biological entity represented by the model element includes the subject of the referenced resource (biological entity B), either physically or logically. This relation might be used to link a complex to the description of its components. • hasProperty • The subject of the referenced resource (biological entity B) is a property of the biological entity represented by the model element. This relation might be used when a biological entity exhibits a certain enzymatic activity or exerts a specific function. • hasTaxon • The biological entity represented by the model element is taxonomically restricted, where the restriction is the subject of the referenced resource (biological entity B). This relation may be used to ascribe a species restriction to a biochemical reaction. • hasVersion • The subject of the referenced resource (biological entity B) is a version or an instance of the biological entity represented by the model element. This relation may be used to represent an isoform of modified form of a biological entity.
Ontologies: namespaces and assertions • Generally specified as triples • RDF is often used to specify triples; it has an XML syntax • OWL is a popular syntax for specifying triples
Inferences: chaining assertions • Birds have feathers & • doves are birds • -> doves have feathers
Popular tool for specifying and editing ongologies: Protoge • http://protege.stanford.edu/ • Example of the Classes/Hierarchy tab:
SPARQL: a language for chaining assertions • Based on RFD • RFD example: <rdf:RDF xmls:rdf=”http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmls:zx=http://www.someurl.org/zx/> <rdf:Description rdf:about=”http://www.awebsite.org/index.html”> <zx:topic>funstuff</zx:topic> </rdf:Description> </rdf:RDF>
Example of RDF • It uses a set of standardized RDF-specific tags, and the second line of code tells us where these tags come from: the w3.org site, which contains a vast store of information about advanced web technology. In other words, we can go to w3.org to find the precise definition of RDF specific tags. • RDF is engineered to also use other sets of tags, in particular, domain-specific tags. In this example, these tags come from a (non-existing) url called someurl.org. The tags themselves are prefaced with “zx:” in the rest of the code, so we know which tags are native RDF and which come from a domain-specific set of tags (called a namespace). • The xml “element” called Description is an RDF-specific tag that tells us we are giving the description of some resource on the Web, namely one at a (non-existing) website called awebsite.org. • The whole piece of code is one triple: It says that the topic of the resource at www.awebsite.org/index.html is funstuff. Here it is as a triple, with all the xml syntax and the namespace information removed: www.awebsite.org/index.html <topic> funstuff
SPARQL (almost) • prefix website1: <http://awebsite.org/ > • SELECT ?x • WHERE • { website1:was-created-by ?x } • This code will find the creators of http://awebsite.org. You could imagine that there are actually many thousands of these triples, and that they tell us who built a large number of different websites. Now, we see the power of this query. It will search through all of these triples and find the two of interest to us, and then pluck off the names of the creators. • In fact, these triples could be distributed all around the Web, and we could imagine a search engine taking this query and running it everywhere on the Web where was-created-by triples are stored, and then having it bring back all the creators of awebsite, even if there are a hundred developers, and even if these names are spread around the Internet.