Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
marcus-lodspeakr
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
uib-ub
Spesialsamlingene
marcus-lodspeakr
Commits
a7bdb9af
Commit
a7bdb9af
authored
13 years ago
by
alangrafu
Browse files
Options
Downloads
Patches
Plain Diff
Fixed small bugs
parent
07902d8d
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
classes/Convert.php
+6
-4
6 additions, 4 deletions
classes/Convert.php
classes/Utils.php
+21
-21
21 additions, 21 deletions
classes/Utils.php
index.php
+1
-1
1 addition, 1 deletion
index.php
utils/changeNamespaceSparql.php
+2
-1
2 additions, 1 deletion
utils/changeNamespaceSparql.php
with
30 additions
and
27 deletions
classes/Convert.php
+
6
−
4
View file @
a7bdb9af
<?
//
Taken
from http://www.php.net/manual/en/language.types.object.php#102735
//
Based (but corrected)
from http://www.php.net/manual/en/language.types.object.php#102735
final
class
Convert
{
# Convert a stdClass to an Array.
static
public
function
object_to_array
(
stdClass
$Class
){
# Typecast to (array) automatically converts stdClass -> array.
$Class
=
(
array
)
$Class
;
$
new
Class
=
array
(
);
# Iterate through the former properties looking for any stdClass properties.
# Recursively apply (array).
foreach
(
$Class
as
$key
=>
$value
){
if
(
is_object
(
$value
)
&&
get_class
(
$value
)
===
'stdClass'
){
$Class
[
$key
]
=
self
::
object_to_array
(
$value
);
$newClass
[
$key
]
=
self
::
object_to_array
(
$value
);
}
else
{
$newClass
[
$key
]
=
$value
;
}
}
return
$Class
;
return
$
new
Class
;
}
# Convert an Array to stdClass.
...
...
This diff is collapsed.
Click to expand it.
classes/Utils.php
+
21
−
21
View file @
a7bdb9af
...
...
@@ -138,26 +138,26 @@ class Utils{
return
$ct
;
}
private
static
function
serializeRdf
(
$data
,
$extension
){
global
$conf
;
require
(
'lib/arc2/ARC2.php'
);
$parser
=
ARC2
::
getRDFParser
();
$parser
->
parse
(
$conf
[
'basedir'
],
$data
);
$triples
=
$parser
->
getTriples
();
$ser
;
switch
(
$extension
){
case
'ttl'
:
$ser
=
ARC2
::
getTurtleSerializer
();
break
;
case
'nt'
:
$ser
=
ARC2
::
getNTriplesSerializer
();
break
;
case
'rdf'
:
$ser
=
ARC2
::
getRDFXMLSerializer
();
break
;
}
$doc
=
$ser
->
getSerializedTriples
(
$triples
);
require
(
'lib/arc2/ARC2.php'
);
$parser
=
ARC2
::
getRDFParser
();
$parser
->
parse
(
$conf
[
'basedir'
],
$data
);
$triples
=
$parser
->
getTriples
();
$ser
;
switch
(
$extension
){
case
'ttl'
:
$ser
=
ARC2
::
getTurtleSerializer
();
break
;
case
'nt'
:
$ser
=
ARC2
::
getNTriplesSerializer
();
break
;
case
'rdf'
:
$ser
=
ARC2
::
getRDFXMLSerializer
();
break
;
}
$doc
=
$ser
->
getSerializedTriples
(
$triples
);
return
$doc
;
}
...
...
@@ -165,7 +165,7 @@ class Utils{
global
$conf
;
$contentType
=
$base
[
'this'
][
'contentType'
];
$extension
=
Utils
::
getExtension
(
$contentType
);
header
(
'Content-Type: '
.
$contentType
);
if
(
!
is_object
(
$data
)){
$data
=
Utils
::
serializeRdf
(
$data
,
$extension
);
...
...
@@ -267,7 +267,7 @@ class Utils{
$baseObj
=
Convert
::
array_to_object
(
$base
);
$base
=
$baseObj
;
}
$r2
=
Convert
::
array_copy
(
$results
);
$r2
=
Convert
::
array_copy
(
$results
);
$r
=
Convert
::
array_to_object
(
$r2
);
$vars
=
compact
(
'uri'
,
'base'
,
'r'
);
$fnc
=
Haanga
::
compile
(
file_get_contents
(
$modelFile
));
...
...
@@ -317,7 +317,7 @@ class Utils{
}
require_once
(
'lib/Haanga/lib/Haanga.php'
);
Haanga
::
configure
(
array
(
'template_dir'
=>
$base
[
'view'
][
'directory'
],
'template_dir'
=>
$conf
[
'home'
]
.
$base
[
'view'
][
'directory'
],
'cache_dir'
=>
$conf
[
'home'
]
.
'cache/'
,
));
if
(
is_object
(
$data
)){
...
...
This diff is collapsed.
Click to expand it.
index.php
+
1
−
1
View file @
a7bdb9af
<?
//
error_reporting(E_ERROR);
error_reporting
(
E_ERROR
);
if
(
!
file_exists
(
'settings.inc.php'
)){
echo
'Need to configure lodspeakr first. Please run "install.sh" first'
;
...
...
This diff is collapsed.
Click to expand it.
utils/changeNamespaceSparql.php
+
2
−
1
View file @
a7bdb9af
...
...
@@ -28,7 +28,7 @@ Since it is very simple, it may be prone to errors, but so far it is usable.
/
*
*
/
//The remote namespace
$remote
=
'http://originalNamespace.com/data/'
;
...
...
@@ -43,6 +43,7 @@ $newget = array();
foreach
(
$_GET
as
$k
=>
$v
){
$newget
[
$k
]
=
preg_replace
(
"|
$local
|"
,
$remote
,
$v
);
}
$url
.
=
'?'
;
$r
=
file_get_contents
(
$url
.
http_build_query
(
$newget
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment