Question

I want to extract information from a large website and generate an ontology. Something that can be processed with description logic.

What data structure is advisable for the extracted html data?

My ideas yet:
- Use Data Frames, Table Structures
- Sets and Relations (sets package and good relations)
- Graphs

.

In the End I want to export the data and plan to process it with predicate logic (or description logic) using another programming language.

I want to use R to extraction information from html pages. But as I understand there is no direct support in R (or packages) for predicate logic or RDF/OWL.

So I need to do the extraction, use some data structure in the process and export the data.

Example Data:

SomeDocument rdf:type PDFDocument
PDFDocument rdfs:subClassOf Document
SomeDocument isUsedAt DepartmentA

DepartmentA rdf:type Department
PersonA rdf:type Person
PersonA headOf DepartmentA

PersonA hasName "John"

Where the instance data is "SomeDocument", "DepartmentA" and "PersonA".

.

If it makes sense, some sort of reasoning (but probably not in R):

AccessedOften(SomeDocument) => ImportantDocument(SomeDocument)
Was it helpful?

Solution

Most important is what does your website data look like? For instance, if it already has RDFa in it you would use an RDFa distiller to get the RDF out; simple; done. Then you could shove the RDF into a triple store. You could augment the website's data by creating your own ontology which you would query using SPARQL, if your ontology make equivalent classes to the data you found on your web site then you are golden. Many triple stores can be queried as SPARQL endpoints via URLs alone, and return in format of XML so even if R has no SPARQL or OWL ontolgoy packages per se, it doesn't mean you can't query the data at all.

OTHER TIPS

If it requires a lot of pages to be downloaded I would use WGET to download those. To proces the files I would use a Perl script to transform the data to a more readable format eg. comma separated. Then I would turn to some programming language to combine in the way you describe, however, I would not go for R in this matter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top