N
N
Nikita2015-09-15 22:02:25
Programming
Nikita, 2015-09-15 22:02:25

How to programmatically implement a semantic web?

I admit right away this is a d / s in the university. But I asked this question more seriously than we are required to. Among classmates, there is a complete misunderstanding of what they want from us, and they hand over modified copies of one work.
The essence of the question is to build a simple semantic network of several elements and write a program that, by polling, will lead you to a certain answer. At the same time, all data must be stored somewhere so that you can change them without touching the code of the program itself.
Very strange for me was the perplexity of the teacher from my question "can the data be stored in the database?", To which the answer was - "no, the Knowledge Base is needed for the semantic network, but this is not a database." I put up with this nonsense and wrote an application in php + MySQL in 10 minutes.
My question is to the community. What is a semantic web? Is it really possible to build it in a relational database? Show examples of implementation, please)
PS I will accept any bundles of technologies, PLs, concepts, etc.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Denis, 2015-09-16
@bitver

Yes, everything is simple here))
The classic question of the database is this: How much does an elephant weigh?
And the knowledge base question would be: What is the average weight of an elephant?
Ask Google for answers to these 2 questions.
On the second, he should give you, in addition, part of the article from Wiki. (Which, in fact, will be the knowledge base in this case)
Let's take a list of objects that have properties.
Elephant - weight, color...
Bear - weight, color, height...
...
So, we have 100 elephants and each has a weight filled.
To the question "How much does an elephant weigh?" how much does ONE elephant weigh, how to choose from a hundred?
The answer is simple, calculate the average weight. (A person understands this, a machine does not)
By clarifying the question by adding the word "medium", it will be more clear to the machine what they want from it (exaggerated of course)
This is a small example that is very simplified.
As for the application.
In the knowledge base, you move along the graph.
Just like on Wikipedia, sometimes "hanging" on it, starting with some event of this century, ending with a description of mathematical algorithms, when more than 20 tabs "to be read" are open.
Go to the toaster. Here you will only have tabs with questions and a couple with users open. You will not be able to search relevantly by comments here without the help of Google, you will not be able to see similar tags. Because you are moving within objects, not their properties.
PS. I do not pretend to be an excellent and sensible answer. I tried to explain as I understand myself, and as simply as possible.

T
tsarevfs, 2015-09-16
@tsarevfs

Either the teacher cannot read according to the manual, or you were offered to use some kind of ready-made tool / algorithm. In principle, to implement a graph structure on a relational database is not a problem. But this may not be the optimal solution, and more specialized storage will work better.
At the level of the training task, the database will most likely work no worse than a self-written solution.

D
Dmitry, 2015-09-24
@Gabriel_vs

The knowledge base is a collection of facts. The statement may be a fact: Moscow is the capital of Russia. Facts can be in the RDF triplet format:
_:Moscow _:is the Capital _:Russia
Data/triples can be connected, for example:
_:Russia _:located on the Mainland _:Eurasia
and the Knowledge Base is already small:
_:Moscow _:is the Capital _:Russia
_: Russia _: located on the mainland _: Eurasia
Such triplets have a graph format. The more triplets, the larger the Knowledge Base. Where to get such triplets or how to model is another question. Can be extracted from other Knowledge Bases (dbpedia, freebase, etc). You can independently extract named entities from non-structured data (for example, media, forums), but this is not a trivial task, but doable.
You can store it both in text files in the form of triplets presented above, and in NoSQL databases.
The semantic web operates with facts/triples. You can find the answer to the question in it as follows:

question = (my_apartment, has, what)
knowledge = (
        (I, own, my_apartment),
        (my_apartment, has, my_computer),
        (my_apartment, has, my_bed),
        (my_apartment, is_in, Philadelphia)
    )
for each statement in knowledge {
    if ((statement.subject == question.subject
            or question.subject == what) {
          and (statement.predicate == question.predicate
            or question.predicate == what)
          and (statement.object == question.object
            or question.object == what))
        call FoundAnswer(statement)
    }
}

Output:
    Answer: my_apartment has my_computer
    Answer: my_apartment has my_bed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question