Docsity

INFORMATION TECHNOLOGY SKILLS, Appunti di Fondamenti di informatica

Toggle sidebar
bg1
INFORMATION TECHNOLOGY SKILLS
REPRESENTING KNOWLEDGE
Why representing knowledge?
Representing knowledge is at the basis of all our interactions, we need it, we need
language; language is the human way of representing knowledge; vocal languages or sign
languages, same way.
In computer science and humanities
Representing knowledge is crucial in many areas:
• archives, libraries, catalogues, etc;
• dictionaries, vocabularies, lexica, etc;
• search engines (indexes), process management;
• social networks;
• entertainment: music publishers, tv/movie producers;
• artificial intelligence. [only for you to know: the father of artificial intelligence is considered to be John
McCarthy (1927 - 2011)
Representing knowledge has to do with making sense of it
Not all representations are efficient or effective in the same way. If a representation succeeds
in transferring knowledge or making it easier to retrieve, then it is a good one.
Representing knowledge for interacting with machines
Since its origin, the goal of Informatics is just to make machine able to perform clever
tasks on our behalf; and to make it possible, we need to represent knowledge in a way
that a machine can process it. How?
• organising the knowledge, to make it easy to retrieve for humans;
• reasoning over knowledge, to produce knowledge itself and make the machine able to take
actions, suggest decisions and produce results.
We want machines to be able to reason on the data that represent the knowledge that we
share with it.
Requirements (questa è la lezione di What’s the best path from LILEC to Piazza Maggiore? Google Maps),
When you are asked to solve a problem, the very first thing is to have a clear
understanding of the problem. To a certain extent, we just have to focus on the problem,
otherwise we risk to overlook certain important aspects that we should address instead. Once
the comprehension of the problem is achieved, very important, try not to be biased by the
idea you already have in mind but try to find the best of all possible solutions.
Google gives you information, which have slow, medium or high level of dynamic. The position
of the streets is unlikely to change often, the traffic changes every day, for example. This
information that Google Maps have now have been acquired with experience, with years and
years of data that it acquired.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b

Anteprima parziale del testo

Scarica INFORMATION TECHNOLOGY SKILLS e più Appunti in PDF di Fondamenti di informatica solo su Docsity!

INFORMATION TECHNOLOGY SKILLS

REPRESENTING KNOWLEDGE

Why representing knowledge? Representing knowledge is at the basis of all our interactions , we need it, we need language; language is the human way of representing knowledge; vocal languages or sign languages, same way. In computer science and humanities Representing knowledge is crucial in many areas:

  • archives, libraries, catalogues, etc;
  • dictionaries, vocabularies, lexica, etc;
  • search engines (indexes), process management;
  • social networks;
  • entertainment: music publishers, tv/movie producers;
  • artificial intelligence. [only for you to know: the father of artificial intelligence is considered to be John McCarthy (1927 - 2011) Representing knowledge has to do with making sense of it Not all representations are efficient or effective in the same way. If a representation succeeds in transferring knowledge or making it easier to retrieve, then it is a good one. Representing knowledge for interacting with machines Since its origin, the goal of Informatics is just to make machine able to perform clever tasks on our behalf ; and to make it possible, we need to represent knowledge in a way that a machine can process it. How?
  • organising the knowledge, to make it easy to retrieve for humans;
  • reasoning over knowledge, to produce knowledge itself and make the machine able to take actions, suggest decisions and produce results. We want machines to be able to reason on the data that represent the knowledge that we share with it. Requirements (questa è la lezione di What’s the best path from LILEC to Piazza Maggiore? Google Maps), When you are asked to solve a problem, the very first thing is to have a clear understanding of the problem. To a certain extent, we just have to focus on the problem, otherwise we risk to overlook certain important aspects that we should address instead. Once the comprehension of the problem is achieved, very important, try not to be biased by the idea you already have in mind but try to find the best of all possible solutions. Google gives you information, which have slow, medium or high level of dynamic. The position of the streets is unlikely to change often, the traffic changes every day, for example. This information that Google Maps have now have been acquired with experience, with years and years of data that it acquired.

INTERNET AND THE WORLD WIDE WEB

Tim Berners Lee , co-inventor of the World Wide Web, published the first web page in

1991. The web then grew so fast that in a few years the whole humanity changed (forever!) its relation with information retrieval. Curiously, the creation of the World Wide Web was born to solve an internal knowledge manager problem of the CERN (European Council for Nuclear Research, basically a physics centre, in Geneva). Berners Lee joined the CERN in 1980 and proposed the Web as a project for solving a problem: a lot of information just got lost because experimental data and documentations were stored on a large variety of computers in a large variety of formats. It was almost impossible to track down everything that might be relevant to someone’s research like this! WWW relied on existing ideas and tools Interesting to know, the web proposed by Berners Lee actually relied on existing tools and ideas, there were already many ideas, tools, methods and paradigms from which he had the possibility (and intuition!) to start. The most important thing that was actually already there is the Internet! Internet was developed by a military project. In 1969 , the Arpa (Advanced Research Project Agency, USA Defence Department) built a computer network called Arpanet. Ted Nelson and Engelbart’s work on hyperlinks in the 1960s. WWW vs Internet Internet is a global system of interconnected computer networks. Attention here: it is not a network of computers; it is A NETWORK OF NETWORKS of computers, which are interconnected on a global scale and use some protocols to exchange messages; if you are in the USA and you want to exchange a message with your friend in Italy, you can use a certain protocol for sending the message through the internet and make sure the message reaches the destination. There are many things that are called protocols, which accompany and support exchanges of information between the different networks connected through the Internet. The Internet consist of both private and public networks ; the University of Bologna network, for example, is a network itself, a private academic one, but it is connected to the whole network of networks. The World Wide Web, on the other side, is an INFORMATION SPACE, where uniform resource locators (URLs) identify documents and web resources in general, which are interlinked by hypertext. The links are, in this case, logical and not physical (well then, of course there is something physical eventually, the electrical signals that go through the cables!) There are other applications that rely on the Internet: emails, for example. We are used to look at emails as part of the web but emails were actually there before the web, because they use their own protocol for communication.

Hosts can be either servers or clients (also both, in some cases)

- the server provides services to other computers, other hosts, which are called clients. - the client is anything that requests a service from a provider. Google is not running on your computer, for example. Google is running in some computer somewhere near you. You are a client who is asking that computer, which is the server, to provide you the access to Google. And Google is not the only possible example; the point is not every application that I use in my computer is actually running on my computer. All the apps that we have on our mobile phones are clients of those applications; we are submitting requests from our mobile phones to those hosts, which are in this case servers.

  • the host can be client for many servers (we, as clients, request many different services)
  • the host can be server for many clients (the University of Bologna, web server, addresses the request of many students, professors, staff and so on). Communication between hosts How does the communication between hosts happen? The massages that we send – being it that for example a request for a webpage, something we do very often – are written and coded in some way and sent through the Internet BUT it is not sent as it is; the message is split into a number of packets , so they flow more easily. We want to send the message from our personal laptop (client) to the UniBo server (m1). Let’s consider our message is split into three packets and these are sent through the Internet, through the backbone, the core of routers through the Internet, and they start forwarding the packets so that they will eventually reach the destination. Once there, they will be put together, the three of them, ‘cause each of them has a reference to the others that composes the messages so once the server understands that it has all the packets of a message, they are put together all again and the message is reconstructed and it is done.

Communication protocols This is possible because there are a set of protocols, supporting this procedure. The protocols control the information flow on the Internet: they give us the means for creating the messages, making sure that they are understood through the whole process and eventually exchanged. In order to do that, they provide a standard format, which everybody has to use, and actions that have to be performed during such exchange. Protocols are the bureaucracy of the internet: they define format and order of exchanged messages, as well as the actions to be performed during these exchanges. The main ones are TCP : Transmission Control Protocol and IP : Internet Protocol. They basically ensure that a certain message is wrapped into a security channel and goes through the best path to make sure it arrives. Protocol used to send a request for accessing a webpage We have protocols ourselves, as commonspeakers: speaking the same language of your interlocutor, for example, is one of it! E a questo punto sono state dette veramente una serie di cose confuse che penso (e spero) siano inutili! IP addresses and DNs We have our home address; our computer has its own address too. Every host has a unique IP address and it has to be unique because otherwise messages sent from a computer (with a unique address) to another (with a non-unique address) could get lost. Internet Assigned Numbers Authority (IANA) takes care of it; it assigns IP address and pledges uniqueness. When you connect to the Internet, it’s your Internet Service Provider that assigns you an IP address (among those it owns). Most of us has dynamic IPs. Our addresses do are unique but they are not fixed: my laptop is assigned a unique IP address today but tomorrow I will be assigned another one, which will be unique as well but different. There is also the possibility to have a static IP address, which simply does not change. By using the VPN service, it is possible to mask one’s IP (if you do not want to be traced!)

The World Wide Web Project Every source of information (today we call it a webpage) would have a unique address , in a standard form.

  • Uniform Resource Locator (URL) Every document would be linked to other documents to allow navigating this information space.
  • Hypertext Transfer Protocol (HTTP) Web documents would be created by using a standard mark-up language.
  • Hypertext Mark-up Language (HTML) A simple piece of software would present HTML documents in an easy-to-read format.
  • The first browser (MOSAIC) WWW: impact and challenges (available for universal use since April 30th, 1993.) The Web aids voices to be heard and oppression to be exposed but it also created new spaces for fraud, theft, espionage and anonymous bullying. It has so evolved into an engine of inequality and vision (TBL Solid Manifesto). Finding the best trade-off between policing the Internet community and retaining its global openness is one of the biggest challenges of our days! There is something already in this direction, something very new. The idea (once again!) comes from Tim Berners Lee, who is somehow trying to “protect” its “creature”! Correcting the WWW with SOLID (Social LInked Data)
  • The web has created a better and more connected world.
  • But we all experience also the critical risks and the negative effects related to sharing our data on the web.
  • According to TBL, this is mainly due to the combination of: ◌ centralised approach to user-data management (data is an asset); ◌ huge few, extremely powerful companies collecting data in exchange of “perceived” benefits; ◌ data-dependent applications; ◌ issues on the privacy. (JDPR – Java Data Protection Recommendations)  these are POD ; each person has its own secure POD.

HTML is the standard mark-up language for creating web pages.

- standard very important that it is standard, so that any browser can read the page you created. - mark-up it is mainly concerned with the layout structure and the formatting and presentation of the information there; this is not a programming language (a programming language allows you to describe procedure, actions, while with a mark-up language you do not describe procedure but how layout is and how content of the page must be displayed). things between angle brackets are tags Page Title My First Heading

My first paragraph.

. Well these are the very basic tags of a HTML document; **** is called the root tag because it is the root element of the page, it has to be there, always. HTML consists of a series of elements: tags and attributes: tags are the main elements and attributes can be associated with them. An HTML element has usually a **** and a **** (yes, with the slash) and everything which is between these two fixed tags is part of the HTML. Why do we use tags? Because in HTML the tags define the way in which content must be formatted or displayed. Considering that each tag has its own meaning in terms of display, layout and things like that, in terms of formatting, we have to tell the browser – which is the main application that processes this data – when this specific layout formatting will end. For example if I want to write my name in italics, I need to tell the browser that only that particular word has to be in italics, otherwise at the end everything from the name on will result in italics. So, always remember to open and close the tags. There are only a few tags, which do not need to be closed by the end tag , because of the meaning of the tag itself. A good example is which is a standard declaration of the HTML5 document. [There are many versions of HTML, this is an HTML5 version, which is in fact the recommended and most common one] An important thing to know is the difference between the and the .

  • everything that is between the start tag and the end tag of the head tag is not visualized, it’s not for visualization purposes, you don’t see it, it is only there for other application to read the code. The only thing you see is the title, but not in the page itself, only at the top of the browser.

each other by edges. The starting node at the very top of the tree is the root node so the root node generates children nodes ( siblings , if they are at the same level) and then these little new nodes generates other nodes in turn, leaves. But why are we speaking about syntactic trees? Why these languages (computer languages?) commonly organize documents and sources as a tree? This is because when you want to process the code with an external application or even with some code within the webpage (ig: if you use a language, called JavaScript, to enrich the webpage with some dynamic behaviours) you can use a tree structure to navigate the document.

How to embed images in the webpage? The tag to do that is .

When you include this tag in the page, similarly to what happens when you include a link, you need to give a reference to the tag, through an attribute, to go and pick the chosen image, so: ****. There are two ways to specify the value of the source attribute of an image tag: *URL = address

  1. absolute URL , which means to provide a link to an external image that is on another machine;
  2. relative URL , which means to provide a link to an image that is hosted within the website. It is usually better to use these second kind of URLs since they will not break if you change domain. A file system is a service of a bigger program, which resides in the computer: the operating system. FILE SISTEM ∈ THE OPERATING SYSTEM. *∈ = “belongs to” Similarly to the HTML document, the file system has a tree structure. The root node is the hard disk (or hard drive), which is usually represented by the c letter. The /slash symbol is for Mac and the \back slash is for Window; anyway when it comes to give the URL, the slash is valid for both Mac and Windows. Now, taking as an example Prof. Presutti Mac, the first children nodes of the hard disk are Applications and Users and under users are obviously going to appear further nodes (leaves!). The user called Val, for example, generates in turn other nodes as for example Desktop or Documents. Generating from Desktop there probably going to be other children nodes, as Index.html. At the end of a file system tree, the very last node (also called leaf) is a file. The node that generated the file, it is called folder. Folders are containers, like a library within which you put and organize books.

Now, in order to identify the address of a file in the three structure , we have to navigate the tree. Every time I go down along the path to reach the file I am searching for, I have to add a /slash before the node down; it’s just a separator, a convention. Let’s write down, in one string, the whole path which has been made; in this case, it will be (starting with the slash alone, representing the file system): /Users/Val/Desktop/img.jpg There is another concept very important for us to know. Let’s say we have our /root which generates an ITS which generates in turn two final files, two leaves: Index.html and Img.jpg. Now, looking at the Index.html, we want to find the attribute src (qualcosa del genere!) and we want to write its address. We can do it in two ways:

  1. there is a more complicated way : we could write down the absolute address: src=”/ITS/img.jpg”
  2. there is a simpler way : we could be able to localize it in the smart way. If I want to refer to a file that is within the same folder of the index file, then I can also get rid of the previous part and directly write the name, because the driver automatically assumes that if there is directly the name of the file, then the file can be found in the same folder, so you write: src=”img.jpg” Now, to sump up: 1) any file in our computer has an address, which is an address provided by the structure of the file system; 2) the file system has a tree structure; 3) if I write an html file and I want to refer to an image that is on my file system, if it is in the same folder of the file, then I can just write its name and it will work. E adesso, homework tutto da gustare, crea una pagina web. Ricorda i tag, perché mi aspetto delle domande a riguardo! KAHOOT time ☼ Who conceived the first algorithm? Ada Lovelace ☼ The inventor of the WorldWideWeb: T.Berners Lee ☼ The place where the WWW was invented: CERN ☼ The first website was published in? 1991 ☼ The Internet and the Web are the same thing? NO ☼ The Web relies on the Internet? YES

LEFT. The Web: webpages connected through href attribute of the tag. RIGHT. A new version of the Web, the Semantic Web: resources are given a category, they are different things. The links between them have meaning too. The Semantic Web is an evolution , an extension of the old Web. What about precise questions? When you query(ied!) Google or other search engine, what you get is a list of documents. In order to find the specific information that you need, you have to read all of them. But is there a way to improve search results and retrieve the answers, when questions are quite specific? Well yes, since a few years. Google decided to improve this system and this comes from this evolution of the Web, the Semantic Web. The Google knowledge graph is a big resource of data where data are connected in a way similar to the picture before. There are things connected to other with some meaningful relations. Yes, this new name “knowledge graph” is nothing more than the Semantic Web! It is what we see on the right of the page when we google something. If we google “Barack Obama” we found, on the right, this knowledge graph and lots of meaningful relations connected to what we searched.

We need some BASIC OF LOGIC before proceeding…

Knowledge representation also identifies a discipline, a field of Artificial Intelligence dedicated to represent information about the world in a form that a computer system can use to solve complex tasks such as formulating medical diagnoses and natural language dialoguing. We want machines to perform tasks on our behalf, even complex task. We want them to elaborate knowledge about objects of the world , not only mathematical calculations.

This triangle describes the way we organize and express our knowledge of the world. When we write or talk about something this is what we do. It is not possible to put the Monna Lisa painting in a computer. In order to allow a computer to elaborate information about Monna Lisa, I assume that the painting is an element of a set (mathematical sense) that a machine is able to manipulate. And in order to do this, we have to draw a mapping between the real world and the set theory , assuming that the formal semantics of set theory is appropriate to describe how the world functions. Of course this is an approximation, we know the world is much more complex than a set of things having relations between them, still, it is a possible approximation that allows us to create an abstraction for the computer to understand! When we refer to this abstract world in terms of “The set theory”, what we can do is associate a formal semantics to any assessment, any statement that we make through this representation model.

This is a set where elements belong to either one of the sets A or B; they belong either to A or to B.

  • difference A \ B = { x | x ∈ A and x ∉ B } This is a set where an element does belong to A (or to B) but does not belong to B (or to A).
  • complement A = { x ∈ U | x ∉ A } and also A = { x ∈ U | x ∉ B } AUB = { x ∈ U | x ∉ A and x ∉ B } This is a set made of everything that is inside the universe of discourse but does not belong to our set. Everything (in the whole universe of discourse!!!!) which is not in our set.

Now, very handy for us to have: the union of set A and set B is equal to the

intersection of set A and set B. At the very same way, the intersection of

set A and set B is equal to the union of set A and set B.

LOGIC is a sort of intermediate language ; on the one hand, it allows us to express lot of

things and on the other hand, it gives us a way to express these things not ambiguously, which is very important for sharing this knowledge with the machine.

We will be practising SYLLOGISTIC. A syllogism is a very antique form of logical reasoning.

A syllogism is a logical argument where a quantified statement – or conclusion – is inferred from two other quantified statements – or premises. All men are mortal Socrates is a man  quantified statements / premises --------------------- Socrates is mortal.  conclusion A syllogism beginning with all is a very common one. Premises usually comprehend “all”, “no” and “some”. We define a binary relation, represented by the ∈ symbol, which is “member of”, “belongs to” or “element of”. Everything staying after this symbol, that is to say what the thing/number is member of, is a set.

A set is a collection of objects that have a specific property / specific
properties.

A = {1, 2)  A is a set and 1 ∈ A, 2 ∈ A and that 3 ∉ A. A set can also be composed of other sets.

A = { {1,2}, {3} }

Let’s take φ as a generic name for a generic property. { x | φ(x)^ }  : “all those object such that for them the property φ holds” “the set of object that have the property described by φ”

E DOPO UN SACCO DI MERAVIGLIOSE LEZIONI DI PRATICA CON IL SOLO

QUADERNO DAVANTI,

A LITTLE BIT OF “THEORETICAL BACKGROUND” IS BACK…!

RDF

We are talking about putting on the web a formal representation of knowledge, with can be also processed by machine. The main idea of the Semantic Web was (20 years ago by now!) was starting with what was already there, which is to say the Web, and arrive to a point where the content of all those documents on the web could be interpretable and processed by machines as well, so that there could be a better cooperation between machines and humans. The key point of the Semantic Web is that everything is uniquely identifier by a code, or identifier, or URI (standing for Uniform Resource Identifier). These identifiers are used to give a specific name to anything. Not only webpages but anything really, any object or concept of the real world. The most recent specification for these unique identifiers is called IRI, Internationalized Resource Identifier.

  • builds on the Uniform Resource Identifier (URI) protocol by expanding the set of permitted characters ; it allows more characters to be used, also including Chinese, Japanese and other kind of coding now supported.
  • while URIs are limited to a subset of the ASCII character set, IRIs may additionally contain most characters from the Universal Character Set (Unicode/ISO 10646), including Chinese, Japanese, Korean and Cyrillic ones.
  • was defined by the Internet Engineering Task Force (IETF) in 2005 in RFC 3987.

Absolute IRIs and prefixed names

As absolute IRIs are quite long to be written when we have to, we can also use prefixed names. We use the term “absolute, in fact, when we express IRI in full, in their full form. Absolute IRIs are enclosed in “ < “ and “ > “ :

A prefix is composed of a label and a colon “ : “

  • we define agent : as the prefix for the namespace https://w3id.org/arco/resource/Agent/
  • agent: 57e93d190f1a192 is the prefixed name for

In other words, as we may have the same prefix for many of these objects, we may want to use a shorter way to indicate that part, which is recurrent. An IRI may be divided in two fragment: the first one is called namespace and the second one, the long code composed of numbers and letters, is called ID : the namespace being, for example, www.unibo.it and the IDs being, in this case, all the students’ and professors’ pages. Now, what do we use to publish this knowledge on the web? We use a model.

Each resource (or entity or triple) is composed of two nodes (subject / object) linked by a directed arc (property). We say directed arc we mean that the arc has a direction, because we read relations with a specific direction.

Graphs

An RDF graph, which we also call “RDF knowledge graph” is a set of this RDF statements. Different RDF statements are connected to each other. When objects are not IRI, they become subject of a new triple; in this case we use a given relation title and we don’t have a IRI but, in fact, a literal, a string.

RDF documents

What we have seen so fare is data model. When we have to create documents and publish them, so we have to store somewhere these triples, we need a sintax. An RDF document is a document that encodes an RDF graph, a concrete RDF syntax, such as Turtle, RDFa, JSON-LD, TriG or RDF/XLM. RDF documents enable the exchange of RDF graphs and RDF datasets between systems. A concrete syntax for RDF may offer many different ways to encode the same RDF graph and RDG dataset, for example through the use of namespace prefixes, relative IRIs, blank node identifiers, and different ordering of statements. While these aspects can have great affect on the convenience of working with the RDF document, they are not significant for its meaning.

RDF serialised as Turtle

Turtle is a concrete syntax to express RDF statements in a simple and intuitive way. A Turtle triple consists of the three components of a statement, followed by a dot to say “dude, the triple ends here.”

Triplestores, datasets, linked data and knowledge datas

All these statements, when put together, they create a graph, and we also call them “linked data” / “linked open data”. A triplestore (or RDF store) is a particular type of database that stores RDF graphs. The term dataset is often used to refer to RDF graphs. RDF graphs are also called linked (open) data : linked because they can link to each other and open because they have the license to allow anyone to reuse them for any purpose. There are also linked knowledge graphs that are not open. Linked data / PDF datasets are a type of knowledge graph (semantic web knowledge graphs). RDF triplestores store RDF triples, they can be queried to retrieve triples. The query language for RDF triplestores is SPARQL. (“sparkol”)

Resource Description Framework

SPARQL Protocol and RDF Language (SPARQL) is the standard language for querying over RDF graphs. Last version: SPARQL 1.1 (Reccomandation) http://www.w3.org/TR/sparql11-query/ SPARQL is based on the fact you recognize patterns on the graphs, [patterns = structures that match to triples.] The simplest pattern in SPARQL is called triple pattern , which is very similar to an RDF statement with the possibility of specifying variables as subject, predicate and object.

Triple Patterns

The basic building block for SPARQL queries is a triple pattern. A triple pattern is like an RDF triple, but you can use a variable in any one of the three positions (subject, predicate, object) to define this sort of template of patterns. We use triple patterns to find the matching triples in a graph and variables act like wildcards that match any node.

From triples to triple patterns