Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
SemWeb
libview
Commits
9bffe29327ab
Commit
6c0397ba
authored
Jul 25, 2018
by
Laurent Wouters
Browse files
Implementing the FoaF views
parent
829f4e357e9f
Changes
9
Hide whitespace changes
Inline
Side-by-side
build.sh
View file @
9bffe293
...
...
@@ -9,6 +9,15 @@ echo "=========================================="
(
cd
"
$ROOT
/rdflib-types"
;
npm
install
)
(
cd
"
$ROOT
/rdflib-types"
;
npm run build
)
echo
""
echo
"=========================================="
echo
"= Building @logilab/librdf"
echo
"=========================================="
(
cd
"
$ROOT
/librdf"
;
rm
-rf
build
)
(
cd
"
$ROOT
/librdf"
;
rm
-rf
node_modules/@types/rdflib
)
(
cd
"
$ROOT
/librdf"
;
npm
install
)
(
cd
"
$ROOT
/librdf"
;
npm run build
)
echo
""
echo
"=========================================="
echo
"= Building @logilab/libview"
...
...
@@ -24,6 +33,7 @@ echo "= Building @logilab/views-dbpedia"
echo
"=========================================="
(
cd
"
$ROOT
/views-dbpedia"
;
rm
-rf
build
)
(
cd
"
$ROOT
/views-dbpedia"
;
rm
-rf
node_modules/@types/rdflib
)
(
cd
"
$ROOT
/views-dbpedia"
;
rm
-rf
node_modules/@logilab/librdf
)
(
cd
"
$ROOT
/views-dbpedia"
;
rm
-rf
node_modules/@logilab/libview
)
(
cd
"
$ROOT
/views-dbpedia"
;
npm
install
)
(
cd
"
$ROOT
/views-dbpedia"
;
npm run build
)
...
...
@@ -34,6 +44,7 @@ echo "= Building @logilab/views-foaf"
echo
"=========================================="
(
cd
"
$ROOT
/views-foaf"
;
rm
-rf
build
)
(
cd
"
$ROOT
/views-foaf"
;
rm
-rf
node_modules/@types/rdflib
)
(
cd
"
$ROOT
/views-foaf"
;
rm
-rf
node_modules/@logilab/librdf
)
(
cd
"
$ROOT
/views-foaf"
;
rm
-rf
node_modules/@logilab/libview
)
(
cd
"
$ROOT
/views-foaf"
;
npm
install
)
(
cd
"
$ROOT
/views-foaf"
;
npm run build
)
...
...
@@ -44,6 +55,7 @@ echo "= Building @logilab/ld-browser"
echo
"=========================================="
(
cd
"
$ROOT
/extension"
;
rm
-rf
build
)
(
cd
"
$ROOT
/extension"
;
rm
-rf
node_modules/@types/rdflib
)
(
cd
"
$ROOT
/extension"
;
rm
-rf
node_modules/@logilab/librdf
)
(
cd
"
$ROOT
/extension"
;
rm
-rf
node_modules/@logilab/libview
)
(
cd
"
$ROOT
/extension"
;
npm
install
)
(
cd
"
$ROOT
/extension"
;
npm run build
)
extension/package.json
View file @
9bffe293
...
...
@@ -20,6 +20,7 @@
"author"
:
"LOGILAB <contact@logilab.fr>"
,
"license"
:
"LGPL-3.0"
,
"dependencies"
:
{
"@logilab/librdf"
:
"file:../librdf"
,
"@logilab/libview"
:
"file:../libview"
,
"@types/chrome"
:
"0.0.69"
,
"@types/rdflib"
:
"file:../rdflib-types"
,
...
...
librdf/package.json
0 → 100644
View file @
9bffe293
{
"name"
:
"@logilab/librdf"
,
"version"
:
"0.1.0"
,
"description"
:
"Library for complementary RDF utilities."
,
"scripts"
:
{
"build"
:
"webpack"
,
"clean"
:
"rm -rf build/*"
,
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
,
"build:production"
:
"NODE_ENV=production webpack"
},
"main"
:
"./build/index.js"
,
"types"
:
"./build/lib/index.d.ts"
,
"repository"
:
{
"type"
:
"hg"
,
"url"
:
"https://bitbucket.org/laurentw/logilab-cubicweb-client"
},
"keywords"
:
[
"DataBrowser"
,
"Typescript"
],
"author"
:
"LOGILAB <contact@logilab.fr>"
,
"license"
:
"LGPL-3.0"
,
"dependencies"
:
{
"@types/node"
:
"^10.5.3"
,
"@types/rdflib"
:
"file:../rdflib-types"
,
"rdflib"
:
"^0.17.0"
},
"devDependencies"
:
{
"source-map-loader"
:
"^0.2.3"
,
"ts-loader"
:
"^4.4.2"
,
"typescript"
:
"^2.9.2"
,
"webpack"
:
"^4.0.1"
,
"webpack-cli"
:
"^2.0.10"
}
}
lib
view
/src/
rdf-utils
.ts
→
lib
rdf
/src/
index
.ts
View file @
9bffe293
File moved
librdf/tsconfig.json
0 → 100644
View file @
9bffe293
{
"compilerOptions"
:
{
"outDir"
:
"./lib/"
,
"sourceMap"
:
true
,
"declaration"
:
true
,
"noImplicitAny"
:
true
,
"module"
:
"commonjs"
,
"target"
:
"es6"
,
"lib"
:
[
"es6"
,
"dom"
],
"jsx"
:
"react"
},
"include"
:
[
"./src/**/*"
],
}
\ No newline at end of file
librdf/webpack.config.js
0 → 100644
View file @
9bffe293
const
path
=
require
(
"
path
"
);
const
isProd
=
process
.
env
.
NODE_ENV
===
"
production
"
;
module
.
exports
=
[
{
entry
:
"
./src/index.ts
"
,
mode
:
isProd
?
"
production
"
:
"
development
"
,
output
:
{
path
:
path
.
resolve
(
__dirname
,
"
build/
"
),
filename
:
"
index.js
"
,
libraryTarget
:
"
umd
"
,
library
:
"
librdf
"
,
umdNamedDefine
:
true
},
devtool
:
"
source-map
"
,
resolve
:
{
extensions
:
[
"
.ts
"
,
"
.tsx
"
,
"
.js
"
,
"
.json
"
]
},
module
:
{
rules
:
[
{
test
:
/
\.
tsx
?
$/
,
loader
:
"
ts-loader
"
},
{
enforce
:
"
pre
"
,
test
:
/
\.
js$/
,
loader
:
"
source-map-loader
"
}
]
}
}
];
libview/src/index.ts
View file @
9bffe293
...
...
@@ -21,6 +21,5 @@
import
*
as
application
from
"
./application
"
;
import
*
as
definition
from
"
./view-def
"
;
import
*
as
implementation
from
"
./view-impl
"
;
import
*
as
rdf
from
"
./rdf-utils
"
;
export
{
application
,
definition
,
implementation
,
rdf
};
export
{
application
,
definition
,
implementation
};
views-foaf/package.json
View file @
9bffe293
...
...
@@ -22,6 +22,7 @@
"author"
:
"LOGILAB <contact@logilab.fr>"
,
"license"
:
"LGPL-3.0"
,
"dependencies"
:
{
"@logilab/librdf"
:
"file:../librdf"
,
"@logilab/libview"
:
"file:../libview"
,
"@types/rdflib"
:
"file:../rdflib-types"
,
"rdflib"
:
"^0.17.0"
,
...
...
views-foaf/src/foaf_person.ts
View file @
9bffe293
...
...
@@ -18,7 +18,13 @@
* with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import
{
definition
,
application
,
implementation
,
rdf
}
from
"
@logilab/libview
"
;
import
{
RdfEntity
,
RdfEntityStore
,
getValueOf
,
getValuesOf
}
from
"
@logilab/librdf
"
;
import
{
definition
,
application
,
implementation
}
from
"
@logilab/libview
"
;
import
{
RdfStore
,
Term
}
from
"
rdflib
"
;
/**
...
...
@@ -42,17 +48,17 @@ interface FoaFPerson {
death
:
string
;
}
function
getLiteralValue
(
entity
:
rdf
.
RdfEntity
,
property
:
string
):
string
{
function
getLiteralValue
(
entity
:
RdfEntity
,
property
:
string
):
string
{
let
result
=
entity
.
getValueForS
(
property
);
return
result
!=
null
?
result
.
value
:
""
;
}
function
loadPerson
(
rdfStore
:
RdfStore
,
target
:
string
):
FoaFPerson
{
let
store
=
new
rdf
.
RdfEntityStore
(
rdfStore
);
let
store
=
new
RdfEntityStore
(
rdfStore
);
let
root
=
store
.
getFromUri
(
target
);
let
focus
=
root
.
getEntityForS
(
"
http://xmlns.com/foaf/0.1/focus
"
);
if
(
focus
!=
null
)
root
=
focus
;
return
{
return
{
name
:
getLiteralValue
(
root
,
"
http://xmlns.com/foaf/0.1/name
"
),
gender
:
getLiteralValue
(
root
,
"
http://xmlns.com/foaf/0.1/gender
"
),
depiction
:
getLiteralValue
(
root
,
"
http://xmlns.com/foaf/0.1/depiction
"
),
...
...
@@ -89,13 +95,9 @@ class FoaFPersonRendering implements implementation.ViewImplementation {
priorityFor
(
store
:
RdfStore
,
target
:
string
):
number
{
if
(
target
==
null
)
return
-
1
;
let
focus
=
rdf
.
getValueOf
(
store
,
target
,
"
http://xmlns.com/foaf/0.1/focus
"
);
let
focus
=
getValueOf
(
store
,
target
,
"
http://xmlns.com/foaf/0.1/focus
"
);
if
(
focus
!=
null
&&
focus
!=
undefined
)
target
=
focus
.
value
;
let
types
=
rdf
.
getValuesOf
(
let
types
=
getValuesOf
(
store
,
target
,
"
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment