Hi Yusuf

There are two problems in tutorial 2:
1. It uses a library outside of the Apache Clerezza project called
org.apache.clerezza:rdf.jena.parser which uses an out-dated version of
Apache Clerezza. The package org.apache.clerezza:rdf.jena.parser is
maintained outside of
Apache Clerezza in github.com/clerezza by reto and me. We can update the
package org.apache.clerezza:rdf.jena.parser to use the current release
version of Apache Clerezza. You could help here as well. You could study
the code and try to understand the relation of that package with the
representation module.
The representation module is not implementing any parser, It delegates the
parsing functionality to any registered ParsingProvider. The package
org.apache.clerezza:rdf.jena.parser is implementing that functionality.
Thus, we principally should use the representation module as well as
org.apache.clerezza:rdf.jena.parser in tutorial 2.
Let me know if you have any questions and whether you would like to fix any
package in github.com/clerezza.

2. The multiple bindings problem of slf4j is due to different libs used by
the representation module and rdf.jena.parser library.

Cheers
Hasan


On Thu, May 27, 2021 at 10:45 AM Hasan Hasan <[email protected]> wrote:

> Hi Yusuf
>
> Thx for the work. I'll have a look today or tomorrow.
>
> Regarding the website, you don't yet have access to the repository. So,
> I'll update it.
>
> Regards
> Hasan
>
> On Tue, May 25, 2021 at 8:39 PM Yusuf Karadağ <[email protected]>
> wrote:
>
>> Hello!
>> So i've tried to run tutorial with *representation *module. But it kept
>> giving *null. *I've kept track of it and it's giving in this line of
>> *Parser.class:
>> *
>>
>> ParsingProvider provider =
>> (ParsingProvider)this.providerMap.get(deParameterizedIdentifier);
>>
>> It can't get the provider and throws
>> *UnsupportedParsingFormatException.*
>>
>>
>> *and the output was:
>> [main] INFO org.apache.clerezza.representation.Parser - constructing
>> Parser
>> [main] WARN org.apache.clerezza.tutorial.Example02 - text/turtle is
>> not supported by the used parser
>>
>> *
>>
>> Then I tried with the dependencies as written in Tutorial 2. I moved
>> *example02.ttl *file under *resources *directory of module and made a
>> change in the code as:
>> package org.apache.clerezza.tutorial;
>> import org.apache.clerezza.commons.rdf.Graph;import
>> org.apache.clerezza.commons.rdf.Triple;import
>> org.apache.clerezza.rdf.core.serializedform.Parser;import
>> org.apache.clerezza.rdf.core.serializedform.SupportedFormat;import
>>
>> org.apache.clerezza.rdf.core.serializedform.UnsupportedFormatException;import
>> org.slf4j.Logger;import org.slf4j.LoggerFactory;
>> import java.io.InputStream;import java.util.Iterator;
>> public class Example02 {
>>
>>     private static final Logger logger = LoggerFactory.getLogger(
>> Example02.class );
>>
>>     public static void main( String[] args ) {
>>
>>         InputStream inputStream =
>> Example02.class.getClassLoader().getResourceAsStream( "example02.ttl"
>> );
>>         Parser parser = Parser.getInstance();
>>
>>         try {
>>             Graph graph = parser.parse( inputStream,
>> SupportedFormat.TURTLE );
>>
>>             Iterator<Triple> iterator = graph.filter( null, null, null );
>>             Triple triple;
>>
>>             while ( iterator.hasNext() ) {
>>                 triple = iterator.next();
>>                 logger.info( String.format( "%s %s %s",
>>                         triple.getSubject().toString(),
>>                         triple.getPredicate().toString(),
>>                         triple.getObject().toString()
>>                 ) );
>>             }
>>         } catch ( UnsupportedFormatException ex ) {
>>             logger.warn( String.format( "%s is not supported by the
>> used parser", SupportedFormat.TURTLE ) );
>>         }
>>     }
>> }
>>
>> And i got the output as:
>>
>> SLF4J: Class path contains multiple SLF4J bindings.
>> SLF4J: Found binding in
>>
>> [jar:file:/C:/Users/yusufkaradag2/.m2/repository/org/slf4j/slf4j-simple/1.7.25/slf4j-simple-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
>> SLF4J: Found binding in
>>
>> [jar:file:/C:/Users/yusufkaradag2/.m2/repository/org/slf4j/slf4j-log4j12/1.7.6/slf4j-log4j12-1.7.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
>> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
>> explanation.
>> SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
>> [main] INFO org.apache.clerezza.rdf.core.serializedform.Parser -
>> constructing Parser
>> [main] INFO org.apache.clerezza.tutorial.Example02 -
>> org.apache.clerezza.rdf.jena.commons.JenaBNodeWrapper@4e636c84
>> <http://clerezza.apache.org/2017/01/example#hasFirstName>
>> "Hasan"^^<http://www.w3.org/2001/XMLSchema#string>
>> [main] INFO org.apache.clerezza.tutorial.Example02 -
>> org.apache.clerezza.rdf.jena.commons.JenaBNodeWrapper@4e636c84
>> <http://clerezza.apache.org/2017/01/example#isA>
>> <http://clerezza.apache.org/2017/01/example#ClerezzaUser>
>>
>> I hope i managed to tell what i meant. Just a bit confused why it
>> didn't work with *representation* module. Should i try with
>> *representation *or this is fine?
>>
>> Regards!
>>
>>
>>
>> On Tue, May 25, 2021 at 2:33 PM Hasan <[email protected]> wrote:
>>
>> > Hi Yusuf
>> >
>> > I'd be glad if you could try to fix tutorial 2 as well
>> > http://clerezza.apache.org/getting-started/tutorial/tutorial-02/
>> >
>> > Best regards
>> >
>> > Hasan
>> >
>>
>>
>> --
>> Yusuf
>>
>

Reply via email to