Thanks very much. I think this is the pointer I needed!
-Mark
On 11/10/2010 12:35 PM, Sergiu Dumitriu wrote:
On 11/10/2010 04:16 PM, Mark Wallace wrote:
On 11/10/2010 9:42 AM, Vincent Massol wrote:
Hi Mark,
On Nov 10, 2010, at 3:24 PM, Mark Wallace wrote:
On 11/5/2010 1:15 PM, Vincent Massol wrote:
> . . .
>> A different example of what I'm trying to do, using a syntax flavor
>> closer to the XWiki 2.1 syntax, might be:
>>
>> Berlin is located in
>> [[Germany>>doc:Main.Germany||property="locatedIn"]]
> This is a link. If you don't need a link you should instead write:
>
> Berlin is located in (% property="locatedIn" %)Germany(%%)
>
> or
>
> Berlin is located in (% property="locatedIn"
> %)[[Germany>>Main.Germany]](%%)
>
> Note: This is going to generate a FormatBlock in XDOM, which you can
> access with Transformation and Macros.
This is something I do from Java? Can you point me to where to get
started? I've spent a good bit of time with the source code and
xwiki.org documentation, but have not yet been able to determine
where to get started. :-(
There are several places where you can interact with the
document's
DOM (we call it the XDOM):
- in Rendering Transformations
- in scripts written in pages since you can get the XDOM using
doc.getXDOM() and thus get this information to perform whatever you want
- in Renderers. For example you might want to generate something
visual or an auto link.
If you want more help you need to tell us what you want to do with
this information.
Vincent, thanks so much for your help and patience.
What I want to do is have the semantic functionality described at the
bottom of this google code "wikimodel" homepage [1] which is:
"Semantic Web compatibility"
One of the most important issues is to be compatible with the main
standard/datamodel of Semantic Web -- with Resource Description
Framework (RDF). It means that both models (WEM as well as WOM)
offer the possibility to map elements from wiki pages to
RDF-statements. So each wiki page can be considered as a node in an
RDF-graph. It allows to transform wiki-tools into powerful yet
simple Semantic Web applications.
Or if you are familiar with Semantic Mediawiki (SMW) [2], I am looking
to get its basic functionality. (I have used SMW extensively, but now
want to consider XWiki because it is Java based and I hope it will be
easier to extend in various ways.)
That functionality is:
1) Treat pages as nodes in an RDF graph. This includes the ability to
categorize pages (make them a member of an owl:Class)
2) Treat links between pages as owl:ObjectProperties.
3) Treat certain values on pages as owl:DatatypeProperties
4) Dynamically query wiki model based on these classes and properties.
For example, say I have a page on Berlin and a page on Germany. The
Berlin page looks like this in standard XWiki markup:
Berlin is located in [[Germany>>doc:Main.Germany]] and has a population
of 3,400,000.
So we know there is a link between Berlin and Germany, but we don't know
what the link means. We also don't know what kind of "object" Berlin is.
For my RDF-ish model of information, I'd like to add a bit more markup
to the page to clarify this, e.g.
Berlin is located in [[Germany>>doc:Main.Germany||property="locatedIn"]]
and has a population of (% property="population" %)3,400,000(%%).
[[Category:City]]
Note how I've given a type to the link between Germany and Berlin (it is
a locatedIn property), some structure to the formerly plain text value
3,400,000 (it is now a named property of Berlin), and finally, with the
[[Category:City]] markup (or something like it) I have stated the kind
of "object" Berlin is; it is a city.
When this page is saved, I want the database to know the following:
Berlin hastype City
Berlin locatedIn Germany
Berlin population 3,400,000
I want the database/datamodel to know this so I can:
1) query this kind of information from other pages for dynamic table
building
2) render this information as RDF through a SPARQL endpoint.
I hope this clarifies my intent. In summary, I want to intercept page
markup on page edits and maintain an RDF-ish model of the knowledge in
the wiki.
Thanks for any help you can provide.
Hi Mark,
Here's a sketch of what you could do:
1. The metadata store should be implemented outside the standard XWiki
store, using a database suited for storing RDF and that knows SPARQL; it
should provide nice APIs to store and retrieve information from it
2. Write a component implementing EventListener and which listens to
document events (DocumentSaveEvent, DocumentUpdateEvent,
DocumentDeleteEvent)
3. This component gets the XDOM of the affected document and looks at
each [[link]] and each (%parameter block%) to see what metadata it can
extract, and stores it (update, delete) into the semantic database
Normally this should already work without any other changes to the
platform, using the syntax you just provided. The problem is that these
properties will end up in the generated HTML, so they create invalid
markup (unknown attributes), but also invalid links, since
[[Category:City]] will try to link to Category:Main.City, that is a
"City" document in the "Main" space of the "Category"
virtual wiki. So,
you can also do:
4. Extend the XHTML Renderer to ignore the property attribute
5a. You can either override DocumentXHTMLLinkTypeRenderer to ignore
links apparently coming from the "Category" wiki, or
5b. Add a new link type and a custom renderer for it, which will make it
easier and more generic to find semantic links
I can't help more with technical details since I'm not that familiar
with the rendering engine.