OK I found it, I'll have a look

2013/9/25 Jesus Nuñez <[email protected]>

> where is it??
>
>
> 2013/9/25 Stéphane Ducasse <[email protected]>
>
>> did you look at SOUL?
>>
>> Stef
>>
>> On Sep 25, 2013, at 9:15 PM, Jesus Nuñez <[email protected]>
>> wrote:
>>
>> In my very first attempt, I tried to port a package which sounds to me
>> like the one you describe. In the examples there was a snoopy world as a
>> search example, maybe you recall it from that.  However I realized that I
>> didn't want to emulate Prolog in Pharo; nothing like fast compiled and
>> optimized code for WAM.
>>
>> The idea was to emulate the language boxes of Helvetia to mix Prolog and
>> Smalltalk code and use NativeBoost to call the swi-prolog shared library,
>> so I could use a highly deployed version of Prolog.  Some time ago I made
>> an inquiry and for handling some text highlighting issues that would help
>> in my aims, just for a direct reference, the code is below:
>>
>> | text textRenderer textShower |
>>> text := 'p(Q,R):-q(R), unify_st(X, smalltalk_code), r(T).
>>> q(Q):-d(R).
>>> q(Q).'.
>>> textRenderer := [
>>> PPTextHighlighter new
>>> parser: PPPrologParser new;
>>>  color: 'small_atom' with: Color blue muchDarker;
>>> bold: 'small_atom';
>>> color: 'unify_st' with: Color green muchDarker;
>>>  bold: 'unify_st';
>>> color: 'string' with: Color gray muchDarker;
>>> color: 'number' with: Color gray muchDarker;
>>>  color: 'boolean' with: Color gray muchDarker;
>>> highlight: text asText.
>>> ].
>>> "                __
>>>                    |
>>>          <Renders IN>
>>>    |
>>>   W
>>> GLMTextPresentation
>>>      |
>>>    <Renders IN>
>>>    |
>>>   W
>>> GLMMorphicRenderer
>>>
>>> "
>>> textShower := GLMMorphicRenderer new.
>>> (textShower open: (
>>> GLMTextPresentation new display: textRenderer; renderGlamorouslyOn:
>>> textShower; yourself )) window title: 'Prolog Editor'.
>>> "Here I created a highlighter through the transform method of the
>>> grammar"
>>> grammar := PPPrologParser new.
>>> highlighter := grammar transform: [ :parser |
>>> Transcript show: parser.
>>> parser class = TokenParser
>>>  ifTrue: [ parser ==> [ :token |
>>> textShower model highlight: token style range: token interval ] ]
>>> ifFalse: [ parser ] ].
>>> text := 'p(Q,R):-q(R), unify_st(X, smalltalk_code), r(T).
>>> q(Q):-d(R).
>>> q(Q).'.
>>> pp := highlighter parse: text asText.
>>
>>
>>
>> However, as I said, it was too much work to create everything from
>> scratch, so I decided only to impose queries and the result looks pretty
>> much as the code I provided in my previous post.
>>
>>
>> I omitted one detail however; I am using a python bridge through the
>> pyswi library which does pretty much was I was trying to achieve with
>> NativeBoost. It is a RPC-JSON server which handles the interaction between
>> Pharo and Prolog and retrieves the query results in a JSON dictionary.
>>
>> At about that time I also was looking at Logtalk (logtalk.org)  for SWI
>>> and maybe waiting for XSB ... as our manager would not go for iLOG and we
>>> were VisualWorks only ... then IBM bought iLOG and something odd happened
>>> to Prologia with Air Liquide in France.
>>
>>
>> Logtalk is pretty much what I wanted to achieve, but the OOP language
>> would be Pharo instead. I still think it would be good to make some effort
>> towards creating such a framework, if I can call it like that.
>>
>> You may know about the prolog for Smalltalk/DOS of about 1990 vintage
>>>  ... I must have it on a floppy in a box somewhere on a shelf.
>>
>>
>> I would be interesting to have a look. Please send me a copy to this
>> email if you find it.
>>
>> Cheers,
>> Jesus
>>
>>
>>
>> 2013/9/25 Robert Shiplett <[email protected]>
>>
>>> You may know about the prolog for Smalltalk/DOS of about 1990 vintage
>>>  ... I must have it on a floppy in a box somewhere on a shelf.
>>>
>>> R
>>>
>>>
>>> On 25 September 2013 10:29, Jesus Nuñez <[email protected]>wrote:
>>>
>>>> I'll try to elaborate but what I can say is only from my limited
>>>> perspective. You can take it as an incomplete argument that needs much
>>>> refinement, but could however serve as a seed for an upcoming idea.
>>>>
>>>> Search: After all we can see the entire web as a large graph which we
>>>> seek to traverse, looking for information. First-order logic is the most
>>>> neutral and natural way of representing the web. With facts and rules that
>>>> convolve to derive new conclusions, logic is perhaps the most compact way
>>>> of representing pretty much any kind of relationships.
>>>>
>>>> Think of a model for a situation that would accept a query as below
>>>> with some facts and rules governing the dynamics of the underlying world:
>>>>
>>>> *"Give me all restaurants in the city where someone whose name is
>>>> Laura has been a client at least once per month during the last 3 months
>>>> and whose has always paid with credit card"*
>>>>
>>>> My opinions are based on the power of tools in Pharo, such as the moose
>>>> family for data visualization and related stuff and of course Seaside,
>>>> together with Prolog first order logic syntax, unification, backtracking
>>>> capabilities, and search based on a sound resolution method. In the case of
>>>> the use of Prolog for the semantic web, see for instance
>>>> http://attempto.ifi.uzh.ch/site <http://attempto.ifi.uzh.ch/site/docs/>
>>>> .
>>>>
>>>> Prolog counts also with mature semantic web packages
>>>> http://www.swi-prolog.org/web/ that handles the semantic web RDF model
>>>> naturally. For instance have a look at http://www.semanticweb.gr/topos/.
>>>> In this very application you may also discover how Pharo can naturally fit
>>>> in a similar application.
>>>>
>>>> In a personal attempt (indeed it is part of my master thesis); since I
>>>> am in Pharo 1.4, I wanted to emulate the helvetia language boxes, to create
>>>> rules in Pharo and interact with Prolog as in the example below for a SQL
>>>> language box,
>>>>
>>>> rows := *SELECT * FROM users WHERE username = @(aString ~=
>>>> /\s*(\w+)\s*/)*
>>>>
>>>> I created a parser in PetitParser for Prolog, however It was too much
>>>> work to create something as the above from scratch (also somewhat involved
>>>> is to handle operator declaration in Prolog) and finally I end up with a
>>>> tool for imposing only queries to Prolog and retrive the results in a JSON
>>>> dictionary using SocketStream for RPC handling and NeoJSONReader to read
>>>> the JSON contents from the stream.
>>>>
>>>> Just for reference, it looks as follows,
>>>>
>>>> Transcript open.
>>>> stream := SocketStream openConnectionToHostNamed: 'localhost' port:
>>>> 31415.
>>>> [
>>>> text:='{"method":"query", "params": ["owns_Zebra(O,X)"], "id":0}'.
>>>> stream nextPutAll:text; flush.
>>>>  Transcript cr; show:(stream upToEnd).
>>>> ] ensure: [
>>>> stream close
>>>> ]
>>>>
>>>> map := (NeoJSONReader on: (result contents) readStream )
>>>> next.
>>>>
>>>> Again, it is only my limited view, and I am only starting to understand
>>>> the fundamentals of semantic web but I think it is not a bad idea to create
>>>> a productive conjunction of this two wonderful worlds. So please don't
>>>> blame on me if I am wrong in all of my thoughs,
>>>>
>>>> Cheers,
>>>> Jesus
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> 2013/9/25 Norbert Hartl <[email protected]>
>>>>
>>>>>
>>>>> Am 25.09.2013 um 13:02 schrieb Jesus Nuñez <[email protected]>:
>>>>>
>>>>> What did happen to Helvetia? Sorry if I am an ignorant here but I
>>>>> think language boxes in Pharo; to interac, remarkably with Prolog, would 
>>>>> be
>>>>>  definitely a plus for semantic web development in Smalltalk.
>>>>>
>>>>> Cheers
>>>>>
>>>>> Sounds interesting. Can you elaborate on that? How could all of those
>>>>> mentioned support the semantic web? [1]
>>>>>
>>>>> Norbert
>>>>>
>>>>> [1] http://en.wikipedia.org/wiki/Semantic_Web
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 2013/9/25 Norbert Hartl <[email protected]>
>>>>>
>>>>>> Looking for semantic web tools I found
>>>>>>
>>>>>> http://www.squeaksource.com/TripleStore/
>>>>>>
>>>>>> Are there other resources for the semantic web in pharo? smalltalk?
>>>>>>
>>>>>> Norbert
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>

Reply via email to