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
052d4d61
Commit
052d4d61
authored
13 years ago
by
alvaro
Browse files
Options
Downloads
Patches
Plain Diff
Fixing type module
parent
92cdd81d
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/Queries.php
+3
-2
3 additions, 2 deletions
classes/Queries.php
classes/Utils.php
+0
-3
0 additions, 3 deletions
classes/Utils.php
classes/modules/typeModule.php
+41
-26
41 additions, 26 deletions
classes/modules/typeModule.php
classes/modules/uriModule.php
+3
-1
3 additions, 1 deletion
classes/modules/uriModule.php
with
47 additions
and
32 deletions
classes/Queries.php
+
3
−
2
View file @
052d4d61
...
@@ -50,9 +50,10 @@ class Queries{
...
@@ -50,9 +50,10 @@ class Queries{
echo
$ex
->
getMessage
();
echo
$ex
->
getMessage
();
}
}
$result
=
array
();
$result
=
array
();
if
(
sizeof
(
$r
[
'results'
][
'bindings'
])
==
0
){
/*
if(sizeof($r['results']['bindings']) == 0){
return 'http://www.w3.org/2000/01/rdf-schema#Resource'; //default value if no type is present
return 'http://www.w3.org/2000/01/rdf-schema#Resource'; //default value if no type is present
}
}*/
//$result[] = 'http://www.w3.org/2000/01/rdf-schema#Resource'; //All resources are rdf:type rdfs:Resource
foreach
(
$r
[
'results'
][
'bindings'
]
as
$v
){
foreach
(
$r
[
'results'
][
'bindings'
]
as
$v
){
$result
[]
=
$v
[
'class'
][
'value'
];
$result
[]
=
$v
[
'class'
][
'value'
];
}
}
...
...
This diff is collapsed.
Click to expand it.
classes/Utils.php
+
0
−
3
View file @
052d4d61
...
@@ -226,9 +226,6 @@ class Utils{
...
@@ -226,9 +226,6 @@ class Utils{
$extension
=
Utils
::
getExtension
(
$contentType
);
$extension
=
Utils
::
getExtension
(
$contentType
);
header
(
'Content-Type: '
.
$contentType
);
header
(
'Content-Type: '
.
$contentType
);
if
(
$extension
!=
'html'
){
$data
=
Utils
::
serializeRdf
(
$data
,
$extension
);
}
Utils
::
showView
(
$lodspk
,
$data
,
$viewFile
);
Utils
::
showView
(
$lodspk
,
$data
,
$viewFile
);
}
}
...
...
This diff is collapsed.
Click to expand it.
classes/modules/typeModule.php
+
41
−
26
View file @
052d4d61
...
@@ -60,14 +60,16 @@ class TypeModule extends abstractModule{
...
@@ -60,14 +60,16 @@ class TypeModule extends abstractModule{
//Check if files for model and view exist
//Check if files for model and view exist
$t
=
Queries
::
getClass
(
$uri
,
$endpoints
[
'local'
]);
$t
=
Queries
::
getClass
(
$uri
,
$endpoints
[
'local'
]);
$obj
=
$this
->
getModelandView
(
$t
,
$extension
);
$obj
=
$this
->
getModelandView
(
$t
,
$extension
);
$modelFile
=
$obj
[
'modelFile'
];
$modelFile
=
$obj
[
'modelFile'
];
$lodspk
[
'model'
]
=
$
obj
[
'model
Dir
'
];
$lodspk
[
'model'
]
=
$
conf
[
'model
'
][
'directory
'
];
$viewFile
=
$obj
[
'viewFile'
];
$viewFile
=
$obj
[
'viewFile'
];
$lodspk
[
'view'
]
=
$obj
[
'view
Dir
'
];
$lodspk
[
'view'
]
=
$obj
[
'view
'
][
'directory
'
];
if
(
$viewFile
==
null
){
if
(
$viewFile
==
null
){
$lodspk
[
'transform_select_query'
]
=
true
;
$lodspk
[
'transform_select_query'
]
=
true
;
}
}
$lodspk
[
'type'
]
=
$modelFile
;
$lodspk
[
'home'
]
=
$conf
[
'basedir'
];
$lodspk
[
'home'
]
=
$conf
[
'basedir'
];
$lodspk
[
'baseUrl'
]
=
$conf
[
'basedir'
];
$lodspk
[
'baseUrl'
]
=
$conf
[
'basedir'
];
$lodspk
[
'module'
]
=
'type'
;
$lodspk
[
'module'
]
=
'type'
;
...
@@ -75,16 +77,22 @@ class TypeModule extends abstractModule{
...
@@ -75,16 +77,22 @@ class TypeModule extends abstractModule{
$lodspk
[
'contentType'
]
=
$acceptContentType
;
$lodspk
[
'contentType'
]
=
$acceptContentType
;
$lodspk
[
'ns'
]
=
$conf
[
'ns'
];
$lodspk
[
'ns'
]
=
$conf
[
'ns'
];
$lodspk
[
'endpoint'
]
=
$conf
[
'endpoint'
];
$lodspk
[
'endpoint'
]
=
$conf
[
'endpoint'
];
$lodspk
[
'view'
]
=
$conf
[
'view'
][
'directory'
];
$lodspk
[
'add_mirrored_uris'
]
=
true
;
$lodspk
[
'add_mirrored_uris'
]
=
true
;
$lodspk
[
'this'
][
'value'
]
=
$uri
;
$lodspk
[
'this'
][
'value'
]
=
$uri
;
$lodspk
[
'this'
][
'curie'
]
=
Utils
::
uri2curie
(
$uri
);
$lodspk
[
'this'
][
'curie'
]
=
Utils
::
uri2curie
(
$uri
);
$lodspk
[
'this'
][
'local'
]
=
$localUri
;
$lodspk
[
'this'
][
'local'
]
=
$localUri
;
$lodspk
[
'this'
][
'extension'
]
=
$extension
;
$lodspk
[
'this'
][
'extension'
]
=
$extension
;
chdir
(
$conf
[
'home'
]
.
$lodspk
[
'model'
]);
chdir
(
$conf
[
'home'
]
.
$conf
[
'model'
][
'directory'
]);
Utils
::
queryFile
(
$modelFile
,
$endpoints
[
'local'
],
$results
,
$first
);
Utils
::
queryFile
(
$modelFile
,
$endpoints
[
'local'
],
$results
,
$first
);
$results
=
Utils
::
internalize
(
$results
);
if
(
$lodspk
[
'resultRdf'
]){
echo
Utils
::
serializeRdf
(
$results
,
$extension
);
exit
(
0
);
}
else
{
$results
=
Utils
::
internalize
(
$results
);
}
$lodspk
[
'first'
]
=
Utils
::
getFirsts
(
$results
);
$lodspk
[
'first'
]
=
Utils
::
getFirsts
(
$results
);
chdir
(
$conf
[
'home'
]);
chdir
(
$conf
[
'home'
]);
if
(
is_array
(
$results
)){
if
(
is_array
(
$results
)){
...
@@ -92,7 +100,8 @@ class TypeModule extends abstractModule{
...
@@ -92,7 +100,8 @@ class TypeModule extends abstractModule{
}
else
{
}
else
{
$resultsObj
=
$results
;
$resultsObj
=
$results
;
}
}
Utils
::
processDocument
(
$viewFile
,
$lodspk
,
$resultsObj
);
//chdir($conf['home'].$conf['model']['directory']);
Utils
::
processDocument
(
$viewFile
,
$lodspk
,
$resultsObj
);
}
}
...
@@ -101,39 +110,45 @@ class TypeModule extends abstractModule{
...
@@ -101,39 +110,45 @@ class TypeModule extends abstractModule{
global
$results
;
global
$results
;
global
$rPointer
;
global
$rPointer
;
global
$lodspk
;
global
$lodspk
;
$objResult
=
array
();
$objResult
=
array
(
'modelFile'
=>
null
,
'viewFile'
=>
null
);
//Defining default views and models
//Defining default views and models
$curieType
=
""
;
$curieType
=
""
;
$objResult
[
'modelFile'
]
=
'main.query'
;
/*
$objResult['modelFile'] = 'main.query';
$objResult
[
'viewFile'
]
=
null
;
//
'html.template';
$objResult['viewFile'] = 'html.template';
$objResult['modelDir'] = $conf['model']['directory'].'type.rdfs:Resource/html.queries/';
$objResult['modelDir'] = $conf['model']['directory'].'type.rdfs:Resource/html.queries/';
$objResult['viewDir'] = $conf['view']['directory'].'type.rdfs:Resource/';
$objResult['viewDir'] = $conf['view']['directory'].'type.rdfs:Resource/';
*/
//Get the first type available
//Get the first type available
$typesAndValues
=
array
();
$typesAndValues
=
array
(
'rdfs:Resource'
=>
-
1
);
foreach
(
$t
as
$v
){
foreach
(
$t
as
$v
){
$curie
=
Utils
::
uri2curie
(
$v
);
$curie
=
Utils
::
uri2curie
(
$v
);
$typesAndValues
[
$curie
]
=
0
;
$typesAndValues
[
$curie
]
=
0
;
if
(
isset
(
$conf
[
'type
s
'
][
'priorities'
][
$curie
])
&&
$conf
[
'type
s
'
][
'priorities'
][
$curie
]
>=
0
){
if
(
isset
(
$conf
[
'type'
][
'priorities'
][
$curie
])
&&
$conf
[
'type'
][
'priorities'
][
$curie
]
>=
0
){
$typesAndValues
[
$curie
]
=
$conf
[
'type
s
'
][
'priorities'
][
$curie
];
$typesAndValues
[
$curie
]
=
$conf
[
'type'
][
'priorities'
][
$curie
];
}
}
}
}
arsort
(
$typesAndValues
);
arsort
(
$typesAndValues
);
foreach
(
$typesAndValues
as
$v
=>
$w
){
foreach
(
$typesAndValues
as
$v
=>
$w
){
$auxModelFile
=
$conf
[
'model'
][
'directory'
]
.
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/'
;
$auxModelFile
=
$conf
[
'model'
][
'directory'
]
.
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/'
.
$extension
.
'.queries'
;
$auxViewFile
=
$conf
[
'view'
][
'directory'
]
.
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/'
;
$auxViewFile
=
$conf
[
'view'
][
'directory'
]
.
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/'
.
$extension
.
'.template'
;
if
(
file_exists
(
$auxModelFile
)
&&
file_exists
(
$auxViewFile
)
&&
$v
!=
null
){
if
(
$v
==
null
){
continue
;}
$auxViewFile
=
$conf
[
'view'
][
'directory'
]
.
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/'
.
$extension
.
'.template'
;
if
(
file_exists
(
$auxModelFile
)){
$auxModelFile
=
$conf
[
'model'
][
'directory'
]
.
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/'
.
$extension
.
'.queries'
;
$objResult
[
'modelFile'
]
=
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/'
.
$extension
.
'.queries'
;
$objResult
[
'viewFile'
]
=
$extension
.
'.template'
;
if
(
file_exists
(
$auxViewFile
)){
$objResult
[
'modelFile'
]
=
$extension
.
'.queries'
;
$objResult
[
'viewFile'
]
=
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/'
.
$extension
.
'.template'
;
break
;
}
elseif
(
$extension
!=
'html'
){
//View doesn't exists (and is not HTML)
$objResult
[
'viewFile'
]
=
null
;
}
return
$objResult
;
}
elseif
(
$extension
!=
'html'
&&
}
elseif
(
$extension
!=
'html'
&&
file_exists
(
$conf
[
'model'
][
'directory'
]
.
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/html.queries'
)){
file_exists
(
$conf
[
'model'
][
'directory'
]
.
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/html.queries'
)){
$auxViewFile
=
$conf
[
'view'
][
'directory'
]
.
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/'
.
$extension
.
'.template'
;
$objResult
[
'modelFile'
]
=
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/html.queries'
;
$auxModelFile
=
$conf
[
'model'
][
'directory'
]
.
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/'
.
$extension
.
'.queries'
;
if
(
file_exists
(
$auxViewFile
)
){
$objResult
[
'modelFile'
]
=
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/html.queries'
;
$objResult
[
'viewFile'
]
=
$conf
[
'type'
][
'prefix'
]
.
$v
.
'/'
.
$extension
.
'.template'
;
$objResult
[
'viewFile'
]
=
null
;
}
else
{
$lodspk
[
'transform_select_query'
]
=
true
;
$objResult
[
'viewFile'
]
=
null
;
}
trigger_error
(
"LODSPeaKr can't find the proper query. Using HTML query instead."
,
E_USER_NOTICE
);
trigger_error
(
"LODSPeaKr can't find the proper query. Using HTML query instead."
,
E_USER_NOTICE
);
break
;
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
classes/modules/uriModule.php
+
3
−
1
View file @
052d4d61
...
@@ -100,7 +100,6 @@ class UriModule extends abstractModule{
...
@@ -100,7 +100,6 @@ class UriModule extends abstractModule{
chdir
(
$conf
[
'home'
]
.
$conf
[
'model'
][
'directory'
]);
chdir
(
$conf
[
'home'
]
.
$conf
[
'model'
][
'directory'
]);
Utils
::
queryFile
(
$modelFile
,
$endpoints
[
'local'
],
$results
,
$first
);
Utils
::
queryFile
(
$modelFile
,
$endpoints
[
'local'
],
$results
,
$first
);
if
(
$lodspk
[
'resultRdf'
]){
if
(
$lodspk
[
'resultRdf'
]){
echo
Utils
::
serializeRdf
(
$results
,
$extension
);
echo
Utils
::
serializeRdf
(
$results
,
$extension
);
...
@@ -137,6 +136,9 @@ class UriModule extends abstractModule{
...
@@ -137,6 +136,9 @@ class UriModule extends abstractModule{
}
elseif
(
$extension
!=
'html'
){
}
elseif
(
$extension
!=
'html'
){
//View doesn't exists (and is not HTML)
//View doesn't exists (and is not HTML)
$viewFile
=
null
;
$viewFile
=
null
;
}
else
{
//No HTML representation as fallback, then not recognized by URI module
return
array
(
null
,
null
);
}
}
return
array
(
$modelFile
,
$viewFile
);
return
array
(
$modelFile
,
$viewFile
);
}
elseif
(
$extension
!=
'html'
&&
file_exists
(
$conf
[
'model'
][
'directory'
]
.
$conf
[
'uri'
][
'prefix'
]
.
$uri
.
'/html.queries'
)){
}
elseif
(
$extension
!=
'html'
&&
file_exists
(
$conf
[
'model'
][
'directory'
]
.
$conf
[
'uri'
][
'prefix'
]
.
$uri
.
'/html.queries'
)){
...
...
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