Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

olid-data-workers/laravel-sparql #401

Open
1ats opened this issue Mar 1, 2023 · 7 comments
Open

olid-data-workers/laravel-sparql #401

1ats opened this issue Mar 1, 2023 · 7 comments

Comments

@1ats
Copy link

1ats commented Mar 1, 2023

@njh
Laravel Framework 8.83.27

EasyRdf\Parser\Exception
Failed to parse statement on line 2
http://localhost:8000/

EasyRdf\Parser\Ntriples::parse
vendor/easyrdf/easyrdf/lib/Parser/Ntriples.php:209

public function parse($graph, $data, $format, $baseUri)
{
parent::checkParseParams($graph, $data, $format, $baseUri);

    if ($format != 'ntriples') {
        throw new \EasyRdf\Exception(
            "EasyRdf\\Parser\\Ntriples does not support: $format"
        );
    }

    $lines = preg_split('/\x0D?\x0A/', strval($data));
    foreach ($lines as $index => $line) {
        $lineNum = $index + 1;
        if (preg_match('/^\s*#/', $line)) {
            # Comment
            continue;
        } elseif (preg_match('/^\s*(.+?)\s+<([^<>]+?)>\s+(.+?)\s*\.\s*$/', $line, $matches)) {
            $this->addTriple(
                $this->parseNtriplesSubject($matches[1], $lineNum),
                $this->unescapeString($matches[2]),
                $this->parseNtriplesObject($matches[3], $lineNum)
            );
        } elseif (preg_match('/^\s*$/', $line)) {
            # Blank line
            continue;
        } else {
            throw new Exception(
          "Failed to parse statement",     **line 209**
                $lineNum
            );
        }
    }

    return $this->tripleCount;
}
@madbob
Copy link

madbob commented Mar 1, 2023

Incidentally I'm the author of laravel-sparql (even if someone else has published it on Packagist...), and that project is abandoned.

If you are interested in a SPARQL ORM (not strictly integrated with Laravel, but yet inspired by Laravel's ORM), I suggest you to give a try to SPARQLer (and provide feedback on the proper repository),

@1ats
Copy link
Author

1ats commented Mar 1, 2023

Dear madbob,

1- Thank you very much for your feedback. I read it on SPARQLer and found it very interesting, but:

2- Right now my biggest problem is finding a tool that allows me to create a Sparql endpoint.

2.1 - I tried using Ontop CLI (https://ontop-vkg.org/tutorial/endpoint/endpoint-cli.html), tomcat-ontop-bundle.zip (https://github.com/ontop/ontop-examples /blob/master/ekaw-tutorial-2016/session1/sparql-endpoint.md) but I had no success in the settings.

2.3 I need to have a Sparql endpoint and then use it here:

/ Wikidata client
$client = new Client([
'host' => 'https://query.wikidata.org/sparql',

2.3 I created my ontology in protégé. Is there a tool or API that allows me to create a Sparql endpoint easily? In this tool (SPARQLer) can I make a sparql query loading my ontology from the computer (without a Sparql endpoint)?

4 - I will be very grateful for your help.

@madbob
Copy link

madbob commented Mar 2, 2023

Well, no: SPARQLer (like EasyRDF, or laravel-sparql) are intended to query an existing endpoint, not publish a new one.

You need a totally different tool: Virtuoso, Jena, QLever... In my experience, the Docker Jena image is (almost) easy to setup.

I don't know if there is some easier tool to publish a mock of a SPARQL endpoint.

@k00ni
Copy link
Contributor

k00ni commented Mar 2, 2023

You could also try (PHP-based) ARC2: https://github.com/semsol/arc2/wiki/SPARQL-Endpoint-Setup. Be aware though, this project is barely maintained.

@1ats
Copy link
Author

1ats commented Mar 3, 2023

Dear @madbob and @k00ni, thank you for your return I will take a look at these tools, anything I will come back here.

@1ats
Copy link
Author

1ats commented Mar 4, 2023

Dear @k00ni,

I did the following setup (https://github.com/semsol/arc2/wiki/SPARQL-Endpoint-Setup). The database connection is working correctly. Takes me to a screen (ARC SPARQL+ Endpoint (v2011-12-01)). But I have some doubts:

1- How do I create a sparql endpoint on this screen?
2- Maybe not necessary, but in which part of this configuration (https://github.com/semsol/arc2/wiki/SPARQL-Endpoint-Setup) do I add my ttl, OWL/XML, rdf file?

Grateful.

@k00ni
Copy link
Contributor

k00ni commented Mar 6, 2023

@1ats please add an issue at https://github.com/semsol/arc2 and discuss it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants