[xwiki-devs] where to extend XWiki link syntax?
Apology for cross posting. Can someone point me to where in the XWiki code I could implement an extended XWiki link syntax? E.g. if I'd like to handle something like this: Berlin is a city in [[locatedIn::Germany>>Germany]] where I'm adding the double-colon syntax before the usual link info. -- Mark Wallace Principal Engineer, Semantic Applications Modus Operandi, Melbourne, FL, USA
Hi Mark, On Nov 5, 2010, at 2:37 AM, [email protected] wrote:
Apology for cross posting. Can someone point me to where in the XWiki code I could implement an extended XWiki link syntax? E.g. if I'd like to handle something like this: Berlin is a city in [[locatedIn::Germany>>Germany]] where I'm adding the double-colon syntax before the usual link info.
This is so cool that you have this need since we've just implemented extensibility for this in XE 2.5+: http://jira.xwiki.org/jira/browse/XWIKI-5486 The doc is now available at: http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule#HAddinganewLink... Thanks -Vincent
I guess my question on the matter is, Does Xwiki support fully the wikimodel? (found here: http://code.google.com/p/wikimodel/ ) Because I get impression that Xwiki as a whole is close to an inline (in text) semantic annotation which can then be grabbed and stored via RDF/OWL, I have not just seen it implemented or documented much of anywhere. I was reading up on Nepomuk and they seemed to have implemented something that is similar to this. If the syntax is not supported, is there a way to link the typing of links as noted above to the concept of a triple, or other such semantic link. I understand the use of objects can be used to add a similar idea of structured knowledgeable information to a page, is there a way that these can be meshed? is there a way to syntactically create "knowledgeable" information currently supported in the page itself? I feel from what I have seen that the framework is there, if its not fully implemented, I think that this is something that could further the idea if a wiki 2.0 (reasonable, searchable, smart, structured information.) -- View this message in context: http://xwiki.475771.n2.nabble.com/where-to-extend-XWiki-link-syntax-tp570761... Sent from the XWiki- Dev mailing list archive at Nabble.com.
Cool. I looked at the links you gave. My goal is to have a possibly wide range of semantic property names for the the links (i.e. a semantic wiki [2]). So if I wanted to use the 2.5+ capabilities you mentioned, then perhaps I could use parameters to get my semantic info in there? [1] says 'XWiki Syntax 2.1 only supports "queryString" and "anchor".' How could I extend this (where in code to get started)? 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"]] I.e. I want to mark-up the link as to what its meaning is... that it represents a located-in relationship. (Same goals as the Semantic Web.) Perhaps there is already a feature like this in xwiki that I don't know about. If not, where would I get started in the code to extend it to do this? Thanks, -Mark References: [1] http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org...) [2] http://code.google.com/p/wikimodel/ On 11/5/2010 5:13 AM, Vincent Massol wrote:
Hi Mark,
On Nov 5, 2010, at 2:37 AM,[email protected] wrote:
Apology for cross posting. Can someone point me to where in the XWiki code I could implement an extended XWiki link syntax? E.g. if I'd like to handle something like this: Berlin is a city in [[locatedIn::Germany>>Germany]] where I'm adding the double-colon syntax before the usual link info.
This is so cool that you have this need since we've just implemented extensibility for this in XE 2.5+: http://jira.xwiki.org/jira/browse/XWIKI-5486
The doc is now available at: http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule#HAddinganewLink...
Thanks
Hi Mark, On Nov 5, 2010, at 6:07 PM, Mark Wallace wrote:
Cool. I looked at the links you gave.
My goal is to have a possibly wide range of semantic property names for the the links (i.e. a semantic wiki [2]). So if I wanted to use the 2.5+ capabilities you mentioned, then perhaps I could use parameters to get my semantic info in there? [1] says 'XWiki Syntax 2.1 only supports "queryString" and "anchor".' How could I extend this (where in code to get started)?
Yes parameters is a good way to add any additional information. You don't need to extend it. You can just use it. Then you need to do something with it. Macros and Transformations can then access this information. Re semantic syntax, see http://jira.xwiki.org/jira/browse/XWIKI-3320
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. Hope it helps, -Vincent
I.e. I want to mark-up the link as to what its meaning is... that it represents a located-in relationship. (Same goals as the Semantic Web.) Perhaps there is already a feature like this in xwiki that I don't know about. If not, where would I get started in the code to extend it to do this?
Thanks, -Mark
References: [1] http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org...) [2] http://code.google.com/p/wikimodel/
On 11/5/2010 5:13 AM, Vincent Massol wrote:
Hi Mark,
On Nov 5, 2010, at 2:37 AM, [email protected] wrote:
Apology for cross posting.
Can someone point me to where in the XWiki code I could implement an
extended XWiki link syntax? E.g. if I'd like to handle something like
this:
Berlin is a city in [[locatedIn::Germany>>Germany]]
where I'm adding the double-colon syntax before the usual link info.
This is so cool that you have this need since we've just implemented extensibility for this in XE 2.5+:
http://jira.xwiki.org/jira/browse/XWIKI-5486
The doc is now available at:
http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule#HAddinganewLink...
Thanks
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. :-(
-Mark
Hope it helps, -Vincent
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. Regarding the Rendering system, it's documented here: http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule Thanks -Vincent
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.
-Mark
References
[1] http://code.google.com/p/wikimodel/
[2] http://semantic-mediawiki.org/wiki/Introduction_to_SMW
> Regarding the Rendering system, it's documented here:
> http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule
>
> Thanks
> -Vincent
>
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. > -Mark > > References > [1] http://code.google.com/p/wikimodel/ > [2] http://semantic-mediawiki.org/wiki/Introduction_to_SMW > > >> Regarding the Rendering system, it's documented here: >> http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule -- Sergiu Dumitriu http://purl.org/net/sergiu/
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. > >> -Mark >> >> References >> [1] http://code.google.com/p/wikimodel/ >> [2] http://semantic-mediawiki.org/wiki/Introduction_to_SMW >> >> >>> Regarding the Rendering system, it's documented here: >>> http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule >
Mark Wallace wrote: > Thanks very much. I think this is the pointer I needed! > -Mark I would like to add this reference to this discussion: Sergiu Dumitriu and Marta Gîrdea and Sabin Buraga, 2007. Knowledge Management in a Wiki Platform via Microformats http://www.aaai.org/Papers/FLAIRS/2007/Flairs07-058.pdf Thanks! > > 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. >> >>> -Mark >>> >>> References >>> [1] http://code.google.com/p/wikimodel/ >>> [2] http://semantic-mediawiki.org/wiki/Introduction_to_SMW >>> >>> >>>> Regarding the Rendering system, it's documented here: >>>> http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule >> > ------------------------------------------------------------------------ > > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > -- Ricardo Rodríguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems
On Thu, Nov 11, 2010 at 01:18, [Ricardo Rodriguez] eBioTIC. < [email protected]> wrote: > > > Mark Wallace wrote: > > Thanks very much. I think this is the pointer I needed! > > -Mark > I would like to add this reference to this discussion: > > Sergiu Dumitriu and Marta Gîrdea and Sabin Buraga, 2007. Knowledge > Management in a Wiki Platform via Microformats > http://www.aaai.org/Papers/FLAIRS/2007/Flairs07-058.pdf > > :) > Thanks! > > > > > 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. > >> > >>> -Mark > >>> > >>> References > >>> [1] http://code.google.com/p/wikimodel/ > >>> [2] http://semantic-mediawiki.org/wiki/Introduction_to_SMW > >>> > >>> > >>>> Regarding the Rendering system, it's documented here: > >>>> http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule > >> > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > devs mailing list > > [email protected] > > http://lists.xwiki.org/mailman/listinfo/devs > > > > -- > Ricardo Rodríguez > CTO > eBioTIC. > Life Sciences, Data Modeling and Information Management Systems > > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs >
On Nov 10, 2010, at 4: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
Right now what is stored in the database on the XWiki side is the document's content in plain text. Thus in order to access it as an XDOM you need to get the document and ask for its XDOM. For example in groovy this is done like this: {{groovy}} def xdom = doc.document.getXDOM() /* Algo: - look for LinkBlock - get the property etc {{/groovy}} However you won't be able to query the whole wiki for this information since it isn't stored in the DB. If you wanted to do that you'd need to write an EventListener and catch the document save event and when your listener is called navigate the XDOM to extract the information you want from it and store it in your own tables in the DB (for example - you could also save it anywhere else you wish: lucene, another external storage, etc).
2) render this information as RDF through a SPARQL endpoint.
You'd need to implement your own Renderer for this (or extend our XHTML Renderer). Note that if all you want is to generate special XHTML based only on the content of the current doc you don't need step 1) above. Thanks -Vincent
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.
-Mark
References [1] http://code.google.com/p/wikimodel/ [2] http://semantic-mediawiki.org/wiki/Introduction_to_SMW
Regarding the Rendering system, it's documented here:
http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule
Thanks -Vincent
participants (7)
-
[Ricardo Rodriguez] eBioTIC. -
Ecaterina Moraru (Valica) -
Mark Wallace -
mbryant -
mwallace@modusoperandi.com -
Sergiu Dumitriu -
Vincent Massol