Skip to content
Jean-Marc Vanel edited this page Mar 2, 2021 · 24 revisions

User Manual - semantic_forms

Table of Contents

Manuel utilisateur en Français

What is this?

Semantic_forms is both a generic semantic web navigation and annotation application, and a framework to build business applications centered on forms (input forms or read only). All data, and all data models (ontologies) leverage on W3C's Semantic Web recommendations: https://en.wikipedia.org/wiki/Semantic_Web

Regarding the implementation, Semantic_forms leverages on Jena TDB, the Play! Framework, Scala and Banana-RDF.

Semantic_forms is functional out the box, once you've built it from sources. No need to install separately a database or other components. You can navigate in your RDF data (Turtle, Json-LD, RDF/XML) loaded in Jena TDB as easily as navigating FOAF profiles on Internet, or mixing both. Semantic_forms is like the dbPedia pages (e.g. http://dbPedia.org/resource/Cycas), but where one can also edit all fields, and load data from anywhere, including data models (RDF vocabularies) and forms.

Use, install

A sandbox is here: http://163.172.179.125:9111/

One can also download and launch the distribution, see Installation of the semantic_forms generic application

The code and how to build from sources is here : https://github.com/jmvanel/semantic_forms/tree/master/scala/forms_play

Possible usages

The usages can be personal (via the zip distribution that is a web application), or collective when hosted on a server. With only the default models and related forms, the usages are possible:

  • contact manager,
  • project manager,
  • blog engine,
  • notes manager,
  • ...

It allows to create one's FOAF profile, navigate on the Web of Data and keeping track, or any structured data management.

Authentication and accounts

Before doing anything, you must be authenticated and / or register with a user name and a password.

NOTE: at the moment there is no email associated with the account. However, the user name can be your email, preceded by mailto: , thus turned into an URL.

WARNING you must choose a user name that is an absolute URI (such as u:uu). Some things will not work with a relative URI (like blah or /ble).

Navigating

Pasting into the field "URI to display" a downloadable URI, say <U1>, be it a dbpedia , or FOAF profile, or an ontology, displays the triples

<U1> ?P ?O .

as dbPedia web application itself does. Then, you can navigate from links to links, also like dbPedia.

Try dragging and dropping this URI in field "URI to display": http://dbpedia.org/resource/Bobby_Bland

There are some starting points in the input field "URI to display", click on the triangle on the right.

Loading semantic data

The next main thing to understand for using the application is that navigating and displaying a downloadable URI, also loads it into the Jena TDB database. And then, downloaded data is used for all application's purposes: displaying triples, forms, labels (from rdfs:label and other predicates), searching, ... Typically, these downloadable URI are:

  • FOAF profile personal profiles
  • dbpedia.org entries
  • URL's from a LDP container (linked Data Platform)

The RDF cache within database

The Jena TDB database acts as a cache for Internet RDF data, which means:

  • displaying the second time is much quicker;
  • taking into account HTTP headers, the data can be reloaded if the remote source is changed

Inside the RDF (SPARQL) database, the triples downloaded from URI <U1> are loaded into a named graph whose name is also <U1>.

You can have a look at the named graphs from the tools page here in the sandbox : http://163.172.179.125:9111/tools

We refer to it as "Semantic Cache".

Contents of the RDF database

  • preloaded ontologies, each in its graph at its URI
  • user data (those entered in the forms), each in a graph user:XXX
  • RDF documents from the Internet, each in his graph at its URI

Search

The wildcard queries, etc, are basic Lucene features, part of Lucene query syntax. The query string is simply passed to the Lucene query parser by jena-text and should support any features of Lucene, see: lucene query parser

Editing

Editing existing data

When displaying a subject URI, click on the link right after "Properties for" to display an input form for this URI. You can modify any triple, create multiple values with "+" button. When finished editing, the SAVE button updates the database.

NOTES:

  • You can not modify any triple, because triples from the Internet, and those created by other users belong to them; they can only be changed by them.
  • the author and the timestamp of each triple are indicated in visualization mode

To remove a triple, remove the contents of the input field. The data will be deleted in the database when pressing the SAVE button.

CAUTION: there is no verification that the input data may be lost if you press something else than the SAVE button.

Creating a new resource of some RDF type

Once you've uploaded an ontology, you can paste a class URI in the "create instance" field , and the inferred form for the class will be displayed. You can also select in the nearby pulldown menu one of the pre-defined classes (FOAF classes, etc). Try looking for an RDF class in LOV or Swoogle search engines, and dragging and drop dropping it in the "create instance" field; for exemple drag'n'drop this URL for creating a biological Species : http://dbpedia.org/ontology/Species

NOTE: by default many useful ontologies are pre-loaded, like dbPedia ontology (see in README to load more ). In the case were the ontology is not pre-loaded, you can load it like any data from its URL/URI, as explained above in Navigating .

Literal (string) fields are entered according to their data type ( plain string, number, date, ... ) with HTML5 compliant input fields . The "EDIT" button nearby opens a popup window for entering a multi-line text.

Resource fields (semantic links) are entered either by:

  1. choosing a possible URI value that is proposed near the field, and that has been inferred from rdfs:range and rdf:type triples,
  2. pasting an URI from elsewhere,
  3. entering any string, that will be added in the database as an URI, with spaces replaced by underscores; the rdf:type of this new URI is set according to the ontologies in database (upon saving the form).

Option 3 creates a new resource in the database that may already exist; better look first in pulldown menu for an already existing resource. This behavior is similar to an ordinary Wiki, where one creates a link (in red) which is later populated. But here it is a "semantic wiki", where each node is typed.

Pay attention to the fields marked with "dbpedia completion", like competences and point of interest. There, one types a few letters, and it is completed with relevant concepts from Wikipedia. CAUTION: the completion widget works only on Firefox, not Chrome(Chromium) nor Opera nor Android.

Annotation of websites

If one "loads" a non-semantic web site (not RDFa nor microdata), this happens in semantic_forms:

  • the type foaf:Document is applied to it
  • an appropriate form is opened for editing, which allows to add metadata, and in particular dc:subject via the dbPedia completion

There is thus a functionality of type Diigo, but with the vast thesaurus of Wikipedia.

Inferences, you said inferences?

semantic_forms does not make a posteriori inference on the SPARQL database. For example, when creating a foaf:Person, semantic_forms will not add a triple to say that this foaf:Person is also a foaf:Agent (which is true). The only inferences are those applied in edit mode of a form, in order to propose properties in accordance with the requested class (in creation mode) or the existing type classes (in re-edition mode). See in Editing forms the inferences made when generating forms.

NOTE Some SPARQL databases, such as BlazeGraph, automatically make simple inferences (RDFS +). Jena TDB, the SPARQL database of semantic_forms does not do it.

Special uses, tips and advice

Wiki aspect

As explained in Editing forms, it is possible to enter any string for an RDF link (transformed into a URL with the prefix of the server followed by /ldp/ ). Subsequently, we can complete this semantic URL by clicking on it, as in a Wiki. But here it is a Wiki based on an RDF semantic network, and the entries are typed by a class URL, with the input form generated from the class.

Social Network: Discussions

The sioc:Post and sioc:Thread classes allow you to enter posts and threads. Thus forum and blogs can be built. We can attack directly with a posts, and then one can answer it via the "answered" field.

Like anything that is SF, you can not change other's posts. If you just want to punctually claim a correction somewhere, just press the "+" button closest; when the other user has modified, you can then remove your entry.

Social Network: Communities, Targeted Views

A major barrier to extended use of semantic_forms is that we risk being invaded by things that do not interest us. We need an analogue of the Facebook home page. You need to be able to conveniently display multiple communities in SF. We are in open data, so the display criterion is not necessarily "my friends" like on Facebook. We would like to have a concept-centered view, which shows what happened recently on that. Thanks to the /history?uri= feature, that's exactly what we can do. The button with the image radial_layout launches exactly that. Precisely it shows the URI's reached from there by RDF paths of length <= 2, sorted in the historical order. This can be seen as a way of making explicit communities of interest. We can focus on any URI: an entry from Wikipedia / dbPedia, a project, a person, etc. Examples: During the biodiversity day at ISWC, a "biodiversity" community was launched: /history?uri=http://dbpedia.org/resource/Biodiversity

We can envisage a lot of communities centered on technical subjects, like the NLP ( Natural Language Processing): /history?uri=http://dbpedia.org/resource/Natural_language_processing

And just to have everything related to software development: /history?uri=http://dbpedia.org/resource/Computer_programming

Of course, you need to have enough links, and enough semantic links, to have views enough populated.

To hook together all participants in a community, we need a "central" URI for that community. If there is not already one:

  • create an ad-hoc project in your projects from your profile foaf: Person
  • then the other participants will add it in their foaf: currentProject

In this way, several communities can cohabit without getting confused. We could also filter on a foaf: Group ad-hoc.

To display a dashboard centered on something, Jazz for example:

Customized history views

We can be even more flexible, and use a SPARQL query to filter what we want to see. In /history currently, we can display in reverse chonological order a SPARQL query's results.

Manage favorite Web pages

One needs to manage his favorite homepages. There is no special UI help for this, but it can be done by creating a sioc:Post, an adding to it the favorite URL's through property rdfs:seeAlso .

CMS (Content Management System) aspect

Using the HTML Wysiwyg editor (Summernote), it is possible to enter rich HTML (including images, links, etc) into any text field (except rdfs:label). The recommended practice is to create a sioc:Post entry, and create HTML in sioc:content property. See blog posts examples in main SF site.

Moreover, it is possible to include links to SPARQL queries results, geographical maps, custom history views, etc, thus creating content linked to data without writing source code. However some knowledge of SPARQL query language is useful. One can create and test these SPARQL bases views in /tools page (link at bottom left).
See UI for Application developer

SPARQL Queries

SPARQL is a mature and well documented query language, having features from Turtle, N3 and SQL. In several places in SF, you can get the SPARQL corresponding to current view, modify it in SPARQL editor page, and get back to previous view, or even choose another view for the same query. Then a link to the customized query + view can be pasted to a sioc:Post in HTML . You can also use generic SPARQL editor YasGui, linked in /tools page. As an example, here is a list of persons connected somehow to an Organization:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
CONSTRUCT WHERE {
  ?p a foaf:Person .
  ?p ?relation ?org .
  ?org a foaf:Organization .
} LIMIT 100

To run this query, one must check "unionDefaultGraph" to take care of the fact that each triple can be in a different named graph ( see Contents of the RDF database ).

Otherwise, the same query must be more complex:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
CONSTRUCT {
  ?p a foaf:Person .
  ?p ?relation ?org .
  ?org a foaf:Organization .
}
WHERE {
  GRAPH ?g  { ?p a foaf:Person . }
  GRAPH ?g1 { ?p ?relation ?org . }
  GRAPH ?g2 { ?org a foaf:Organization . }
} LIMIT 100

Future work

See gibhub issues