Just a quick post. Wanted to share the beginnings of my work on creating new widgets to exploit the upcoming V7 release of MarkLogic server.
As you can see from the below I’ve been busy creating widgets for ML7. The topmost widget is an interactive SPARQL query builder. You can populate this with your own entities or just use the defaults (‘all’ entities, named graphs, or individual facts as results).
In the example below I’m searching for a Person who is a member of an Organisation with the name of ‘Animal Freedom’.
Below the SPARQL search widget are three other widgets. The first (leftmost) lists entities by their name field and type that are the results of the SPARQL query. Clicking on one of these links displays facts about that entity in the Entity Facts widget.
The final widget is a standard content Results widget. This doesn’t do anything yet, but the ultimate aim is to store triples about named graphs and where they were inferred from. This links facts back to their original documents, and is a useful way to find other content that may be of interest.
Both the fact search results and entity facts widgets make extensive use of lazy loading of information. The search shown only returns IRIs about matching Person entities. These aren’t any great use in search results or in relationships in a list of entity facts. Instead I draw the widgets, then afterwards load each results’ rdftype. I have a config file in my application that lists the predicate holding the human readable name for each entity type. This is consulted prior to loading the single fact holding the entity’s name. This is how I can draw the common name and type dynamically. Much more user friendly than a simple IRI.
There is a lot of SPARQL being executed in this single page. Firstly, the SPARQL for the main query. Then in the fact results 2 queries for the RDF types of the results, and 2 more for their name values. Clicking on an entity results in a SPARQL query to fetch all facts about that entity. (Our 6th query) For the above entity, Abraham Troublemaker, he has 4 relationships to other entities. This results in another 8 queries for their types and names. A total of 14 SPARQL queries.
Performance is actually quite good. Some performance improvements are possible – for instance in the above search we could pull back not just the IRI but also the common name field.
Hopefully this has shown some of the power available in MarkLogic 7, and how you can quickly build up a compelling application UI based on all data stored. You can get this code right now from the main MLDB site.