1 <?php rcs_id('$Id: SemanticWeb.php,v 1.1 2006-03-07 20:53:55 rurban Exp $');
3 * What to do on ?format=rdf What to do on ?format=owl
5 * Map relations on a wikipage to a RDF ressource to build a "Semantic Web"
6 * - a web ontology frontend compatible to OWL (web ontology language).
7 * http://www.w3.org/2001/sw/Activity
8 * Simple RDF ontologies contain facts and rules, expressed by RDF triples:
9 * Subject (page) -> Predicate (verb, relation) -> Object (links)
10 * OWL extents that to represent a typical OO framework.
14 * subClassOf, restrictedBy, onProperty, intersectionOf, allValuesFrom, ...
15 * someValuesFrom, unionOf, equivalentClass, disjointWith, ...
16 * plus the custom vocabulary (ontology): canRun, canBite, smellsGood, ...
17 * OWL Subjects: Class, Restriction, ...
18 * OWL Properties: type, label, comment, ...
19 * DAML should also be supported.
22 * - Another way to represent various KB models in various DL languages. (OWL/DAML/other DL)
23 * - Frontend to various KB model reasoners and representations.
24 * - Generation/update of static wiki pages based on external OWL/DL/KB (=> ModelTest/Categories)
25 * KB Blackboard and Visualization.
26 * - OWL generation based on static wiki pages (ModelTest?format=owl)
28 * Facts: (may be represented by special links on a page)
29 * - Each page must be representable with an unique URL.
30 * - Each fact must be representable with an unique RDF triple.
31 * - A class is represented by a category page.
32 * - To represent more expressive description logic, "enriched"
33 * links will not be enough (? variable symbolic objects).
35 * Rules: (may be represented by special content on a page)
36 * - Syntax: reasoner backend specific, or common or ?
38 * RDF Triple: (representing facts)
39 * Subject (page) -> Predicate (verb, relation) -> Object (links)
42 * Special link qualifiers represent RDF triples, based on RDF standard notation.
43 * See RDF standard DTD's on daml.org and w3.org, plus your custom predicates.
45 * Example: page [Ape] isa:Animal, ...
46 * Object: special links on a page.
48 * Model: Basepage for a KB. (parametrizeable pages or copies of modified snapshots?)
50 * DL: Description Logic
54 * Of course *real* expert systems ("reasoners") will help/must be used in
55 * optimization and maintainance of the SemanticWeb KB (Knowledge
56 * Base). Hooks will be tested to KM (an interactive KB playground),
57 * LISA (standard unifier), FaCT, RACER, ...
59 * Maybe also ZEBU (parser generator) is needed to convert the wiki KB
60 * syntax to the KB reasoner backend (LISA, KM, CLIPS, JESS, FaCT,
63 * pOWL is a simple php backend with some very simple AI logic in PHP,
64 * though I strongly doubt the usefulness of reasoners not written in
67 * SEAL (omntoweb.org) is similar to that, just on top of the Zope CMF.
68 * FaCT uses e.g. this KB DTD:
69 <!ELEMENT KNOWLEDGEBASE (DEFCONCEPT|DEFROLE|IMPLIESC|EQUALC|IMPLIESR|EQUALR|TRANSITIVE|FUNCTIONAL)*>
70 <!ELEMENT CONCEPT (PRIMITIVE|TOP|BOTTOM|AND|OR|NOT|SOME|ALL|ATMOST|ATLEAST)>
71 <!ELEMENT ROLE (PRIMROLE|INVROLE)>
72 ... (facts and rules described in XML)
75 * http://phpwiki.org/SemanticWeb,
76 * http://en.wikipedia.org/wiki/Knowledge_representation
77 * http://www.ontoweb.org/
78 * http://www.semwebcentral.org/ (OWL on top of GForge)
81 * Author: Reini Urban <rurban@x-ray.at>
83 /*============================================================================*/
85 Copyright 2004 Reini Urban
87 This file is part of PhpWiki.
89 PhpWiki is free software; you can redistribute it and/or modify
90 it under the terms of the GNU General Public License as published by
91 the Free Software Foundation; either version 2 of the License, or
92 (at your option) any later version.
94 PhpWiki is distributed in the hope that it will be useful,
95 but WITHOUT ANY WARRANTY; without even the implied warranty of
96 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
97 GNU General Public License for more details.
99 You should have received a copy of the GNU General Public License
100 along with PhpWiki; if not, write to the Free Software
101 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
105 * RdfWriter - A class to represent a wikipage as RDF. Supports ?format=rdf
109 * - RecentChanges (RecentChanges?format=rss)
110 * channel: ... item: ...
112 include_once('lib/RssWriter.php');
113 class RdfWriter extends RssWriter // in fact it should be rewritten to be other way round.
115 function RdfWriter () {
116 $this->XmlElement('rdf:RDF',
117 array('xmlns' => "http://purl.org/rss/1.0/",
118 'xmlns:rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'));
120 $this->_modules = array(
122 'content' => "http://purl.org/rss/1.0/modules/content/",
123 'dc' => "http://purl.org/dc/elements/1.1/",
126 $this->_uris_seen = array();
127 $this->_items = array();
132 * OwlWriter - A class to represent a set of wiki pages (a DL model) as OWL.
133 * Supports ?format=owl
139 class OwlWriter extends RdfWriter {
143 * ModelWriter - Export a KB as set of wiki pages.
144 * Probably based on some convenient DL expression syntax. (deffact, defrule, ...)
150 class ModelWriter extends OwlWriter {
155 * ReasonerBackend - hooks to reasoner backends.
156 * via http as with DIG,
159 class ReasonerBackend {
160 function ReasonerBackend () {
164 * transform to reasoner syntax
166 function transformTo () {
170 * transform from reasoner syntax
172 function transformFrom () {
183 class ReasonerBackend_LISA extends ReasonerBackend {
186 class ReasonerBackend_KM extends ReasonerBackend {
190 // (c-file-style: "gnu")
195 // c-hanging-comment-ender-p: nil
196 // indent-tabs-mode: nil