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
logilab-views
Commits
9257053f63e8
Commit
b2203d90
authored
Oct 13, 2020
by
Fabien Amarger
Browse files
fix: [prettier] Prettify everything
parent
f58692f544de
Pipeline
#17321
failed with stages
in 4 minutes and 7 seconds
Changes
17
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/blogpost/BlogPostView.tsx
View file @
9257053f
import
*
as
React
from
"
react
"
;
import
{
BlogPost
}
from
"
./blogpostschema
"
;
import
{
DublinCoreElementComponent
}
from
"
../dublincore/DublinCoreImpl
"
;
import
*
as
React
from
'
react
'
;
import
{
BlogPost
}
from
'
./blogpostschema
'
;
import
{
DublinCoreElementComponent
}
from
'
../dublincore/DublinCoreImpl
'
;
export
const
BlogPostComponent
:
React
.
FC
<
{
blogpost
:
BlogPost
;
blogpost
:
BlogPost
;
}
>
=
({
blogpost
})
=>
{
const
container
=
blogpost
.
container
;
return
(
<>
<
div
>
{
"
Blog Post of
"
}
<
a
href
=
{
container
.
__resource
.
uri
}
>
{
container
.
title
}
</
a
>
</
div
>
<
DublinCoreElementComponent
{
...
blogpost
}
/>
</>
);
const
container
=
blogpost
.
container
;
return
(
<>
<
div
>
{
'
Blog Post of
'
}
<
a
href
=
{
container
.
__resource
.
uri
}
>
{
container
.
title
}
</
a
>
</
div
>
<
DublinCoreElementComponent
{
...
blogpost
}
/>
</>
);
};
src/blogpost/BlogView.tsx
View file @
9257053f
import
*
as
React
from
"
react
"
;
import
{
Weblog
}
from
"
./blogpostschema
"
;
import
{
DublinCoreElementComponent
}
from
"
../dublincore/DublinCoreImpl
"
;
import
*
as
React
from
'
react
'
;
import
{
Weblog
}
from
'
./blogpostschema
'
;
import
{
DublinCoreElementComponent
}
from
'
../dublincore/DublinCoreImpl
'
;
export
const
BlogComponent
:
React
.
FC
<
{
blog
:
Weblog
;
blog
:
Weblog
;
}
>
=
({
blog
})
=>
{
return
(
<>
<
DublinCoreElementComponent
{
...
blog
}
/>
<
DublinCoreElementComponent
{
...
blog
.
posts
[
0
]
}
/>
<
h1
>
Other posts:
</
h1
>
<
ul
>
{
blog
.
posts
// .sort((a, b) => b.date.localeCompare(a.date))
.
map
(
blogpost
=>
(
<
li
key
=
{
blogpost
.
__resource
.
uri
}
>
<
a
href
=
{
blogpost
.
__resource
.
uri
}
>
{
blogpost
.
title
}
</
a
>
</
li
>
))
}
</
ul
>
</>
);
return
(
<>
<
DublinCoreElementComponent
{
...
blog
}
/>
<
DublinCoreElementComponent
{
...
blog
.
posts
[
0
]
}
/>
<
h1
>
Other posts:
</
h1
>
<
ul
>
{
blog
.
posts
// .sort((a, b) => b.date.localeCompare(a.date))
.
map
(
(
blogpost
)
=>
(
<
li
key
=
{
blogpost
.
__resource
.
uri
}
>
<
a
href
=
{
blogpost
.
__resource
.
uri
}
>
{
blogpost
.
title
}
</
a
>
</
li
>
))
}
</
ul
>
</>
);
};
src/blogpost/blog.tsx
View file @
9257053f
...
...
@@ -18,91 +18,76 @@
* with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import
*
as
React
from
"
react
"
;
import
*
as
ReactDOM
from
"
react-dom
"
;
import
*
as
React
from
'
react
'
;
import
*
as
ReactDOM
from
'
react-dom
'
;
import
{
application
,
definition
,
implementation
,
rdfEntities
}
from
"
@logilab/libview
"
;
import
*
as
$rdf
from
"
rdflib
"
;
import
{
ONTOLOGY
}
from
"
../common/schema
"
;
import
{
BlogComponent
}
from
"
./BlogView
"
;
import
{
loadBlog
,
BlogPost
}
from
"
./blogpostschema
"
;
import
{
httpsAlias
}
from
"
../common/aliases
"
;
import
{
application
,
definition
,
implementation
,
rdfEntities
}
from
'
@logilab/libview
'
;
import
*
as
$rdf
from
'
rdflib
'
;
import
{
ONTOLOGY
}
from
'
../common/schema
'
;
import
{
BlogComponent
}
from
'
./BlogView
'
;
import
{
loadBlog
,
BlogPost
}
from
'
./blogpostschema
'
;
import
{
httpsAlias
}
from
'
../common/aliases
'
;
/**
* The descriptor for the default blog view
*/
const
DESCRIPTOR_BLOG
:
definition
.
ViewDescriptor
=
{
identifier
:
"
::Logilab::Blog
"
,
name
:
"
Logilab: Blog View
"
,
description
:
"
Renders a blog
"
,
entrypoint
:
"
VIEW_BLOG_ENTRYPOINT
"
,
resourceCss
:
[
{
uri
:
"
https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css
"
}
],
resourceJs
:
[],
resourceMain
:
{
uri
:
"
http://localhost:8080/view_blog.js
"
}
identifier
:
'
::Logilab::Blog
'
,
name
:
'
Logilab: Blog View
'
,
description
:
'
Renders a blog
'
,
entrypoint
:
'
VIEW_BLOG_ENTRYPOINT
'
,
resourceCss
:
[
{
uri
:
'
https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css
'
,
},
],
resourceJs
:
[],
resourceMain
:
{
uri
:
'
http://localhost:8080/view_blog.js
'
,
},
};
class
BlogRendering
implements
implementation
.
ViewImplementation
{
descriptor
:
definition
.
ViewDescriptor
;
constructor
()
{
this
.
descriptor
=
DESCRIPTOR_BLOG
;
this
.
priorityFor
=
this
.
priorityFor
.
bind
(
this
);
this
.
render
=
this
.
render
.
bind
(
this
);
}
descriptor
:
definition
.
ViewDescriptor
;
constructor
()
{
this
.
descriptor
=
DESCRIPTOR_BLOG
;
this
.
priorityFor
=
this
.
priorityFor
.
bind
(
this
);
this
.
render
=
this
.
render
.
bind
(
this
);
}
priorityFor
(
store
:
$rdf
.
Formula
,
target
:
application
.
Resource
):
number
{
const
storeAliases
=
ONTOLOGY
.
aliases
;
storeAliases
.
push
(
httpsAlias
(
target
.
uri
));
let
repo
=
new
rdfEntities
.
RdfEntityStore
(
store
,
storeAliases
,
ONTOLOGY
.
inverses
);
let
entity
=
repo
.
entityForUri
(
target
.
uri
);
priorityFor
(
store
:
$rdf
.
Formula
,
target
:
application
.
Resource
):
number
{
const
storeAliases
=
ONTOLOGY
.
aliases
;
storeAliases
.
push
(
httpsAlias
(
target
.
uri
));
let
repo
=
new
rdfEntities
.
RdfEntityStore
(
store
,
storeAliases
,
ONTOLOGY
.
inverses
);
let
entity
=
repo
.
entityForUri
(
target
.
uri
);
let
entityTypes
=
entity
.
getEntitiesForS
(
"
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"
);
if
(
entityTypes
.
length
>
0
)
{
let
x
=
entityTypes
.
find
(
(
entity
:
rdfEntities
.
RdfEntity
)
=>
entity
.
uris
.
indexOf
(
"
http://ns.cubicweb.org/cubicweb/0.0/Blog
"
)
>=
0
);
if
(
x
)
{
// The entity is a Blog
return
10
;
}
let
entityTypes
=
entity
.
getEntitiesForS
(
'
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
'
);
if
(
entityTypes
.
length
>
0
)
{
let
x
=
entityTypes
.
find
(
(
entity
:
rdfEntities
.
RdfEntity
)
=>
entity
.
uris
.
indexOf
(
'
http://ns.cubicweb.org/cubicweb/0.0/Blog
'
)
>=
0
);
if
(
x
)
{
// The entity is a Blog
return
10
;
}
}
return
implementation
.
VIEW_PRIORITY_INAPPROPRIATE
;
}
return
implementation
.
VIEW_PRIORITY_INAPPROPRIATE
;
}
render
(
renderer
:
application
.
ViewRenderer
,
context
:
application
.
RenderingContext
,
target
:
application
.
Resource
):
implementation
.
ViewRendering
{
let
blog
=
loadBlog
(
renderer
,
context
,
target
);
let
externals
=
blog
.
posts
.
map
((
blopost
:
BlogPost
)
=>
application
.
cloneResource
(
blopost
.
__resource
)
);
let
result
=
document
.
createElement
(
"
div
"
);
ReactDOM
.
render
(<
BlogComponent
blog
=
{
blog
}
/>,
result
);
return
{
dom
:
result
,
suggestedResources
:
externals
};
}
render
(
renderer
:
application
.
ViewRenderer
,
context
:
application
.
RenderingContext
,
target
:
application
.
Resource
):
implementation
.
ViewRendering
{
let
blog
=
loadBlog
(
renderer
,
context
,
target
);
let
externals
=
blog
.
posts
.
map
((
blopost
:
BlogPost
)
=>
application
.
cloneResource
(
blopost
.
__resource
));
let
result
=
document
.
createElement
(
'
div
'
);
ReactDOM
.
render
(<
BlogComponent
blog
=
{
blog
}
/>,
result
);
return
{
dom
:
result
,
suggestedResources
:
externals
,
};
}
}
/**
...
...
src/blogpost/blogpost.tsx
View file @
9257053f
...
...
@@ -18,91 +18,77 @@
* with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import
*
as
React
from
"
react
"
;
import
*
as
ReactDOM
from
"
react-dom
"
;
import
*
as
React
from
'
react
'
;
import
*
as
ReactDOM
from
'
react-dom
'
;
import
{
application
,
definition
,
implementation
,
rdfEntities
}
from
"
@logilab/libview
"
;
import
*
as
$rdf
from
"
rdflib
"
;
import
{
ONTOLOGY
}
from
"
../common/schema
"
;
import
{
BlogPostComponent
}
from
"
./BlogPostView
"
;
import
{
loadBlogPost
}
from
"
./blogpostschema
"
;
import
{
httpsAlias
}
from
"
../common/aliases
"
;
import
{
application
,
definition
,
implementation
,
rdfEntities
}
from
'
@logilab/libview
'
;
import
*
as
$rdf
from
'
rdflib
'
;
import
{
ONTOLOGY
}
from
'
../common/schema
'
;
import
{
BlogPostComponent
}
from
'
./BlogPostView
'
;
import
{
loadBlogPost
}
from
'
./blogpostschema
'
;
import
{
httpsAlias
}
from
'
../common/aliases
'
;
/**
* The descriptor for the default blog post view
*/
const
DESCRIPTOR_BLOGPOST
:
definition
.
ViewDescriptor
=
{
identifier
:
"
::Logilab::BlogPost
"
,
name
:
"
Logilab: Blog Post View
"
,
description
:
"
Renders a blog post
"
,
entrypoint
:
"
VIEW_BLOGPOST_ENTRYPOINT
"
,
resourceCss
:
[
{
uri
:
"
https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css
"
}
],
resourceJs
:
[],
resourceMain
:
{
uri
:
"
http://localhost:8080/view_blogpost.js
"
}
identifier
:
'
::Logilab::BlogPost
'
,
name
:
'
Logilab: Blog Post View
'
,
description
:
'
Renders a blog post
'
,
entrypoint
:
'
VIEW_BLOGPOST_ENTRYPOINT
'
,
resourceCss
:
[
{
uri
:
'
https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css
'
,
},
],
resourceJs
:
[],
resourceMain
:
{
uri
:
'
http://localhost:8080/view_blogpost.js
'
,
},
};
class
BlogPostRendering
implements
implementation
.
ViewImplementation
{
descriptor
:
definition
.
ViewDescriptor
;
constructor
()
{
this
.
descriptor
=
DESCRIPTOR_BLOGPOST
;
this
.
priorityFor
=
this
.
priorityFor
.
bind
(
this
);
this
.
render
=
this
.
render
.
bind
(
this
);
}
descriptor
:
definition
.
ViewDescriptor
;
constructor
()
{
this
.
descriptor
=
DESCRIPTOR_BLOGPOST
;
this
.
priorityFor
=
this
.
priorityFor
.
bind
(
this
);
this
.
render
=
this
.
render
.
bind
(
this
);
}
priorityFor
(
store
:
$rdf
.
Formula
,
target
:
application
.
Resource
):
number
{
const
storeAliases
=
ONTOLOGY
.
aliases
;
storeAliases
.
push
(
httpsAlias
(
target
.
uri
));
let
repo
=
new
rdfEntities
.
RdfEntityStore
(
store
,
storeAliases
,
ONTOLOGY
.
inverses
);
let
entity
=
repo
.
entityForUri
(
target
.
uri
);
priorityFor
(
store
:
$rdf
.
Formula
,
target
:
application
.
Resource
):
number
{
const
storeAliases
=
ONTOLOGY
.
aliases
;
storeAliases
.
push
(
httpsAlias
(
target
.
uri
));
let
repo
=
new
rdfEntities
.
RdfEntityStore
(
store
,
storeAliases
,
ONTOLOGY
.
inverses
);
let
entity
=
repo
.
entityForUri
(
target
.
uri
);
let
entityTypes
=
entity
.
getEntitiesForS
(
"
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"
);
if
(
entityTypes
.
length
>
0
)
{
let
x
=
entityTypes
.
find
(
(
entity
:
rdfEntities
.
RdfEntity
)
=>
entity
.
uris
.
indexOf
(
"
http://ns.cubicweb.org/cubicweb/0.0/BlogEntry
"
)
>=
0
);
if
(
x
)
{
// The entity is a BlogPost
return
10
;
}
let
entityTypes
=
entity
.
getEntitiesForS
(
'
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
'
);
if
(
entityTypes
.
length
>
0
)
{
let
x
=
entityTypes
.
find
(
(
entity
:
rdfEntities
.
RdfEntity
)
=>
entity
.
uris
.
indexOf
(
'
http://ns.cubicweb.org/cubicweb/0.0/BlogEntry
'
)
>=
0
);
if
(
x
)
{
// The entity is a BlogPost
return
10
;
}
}
return
implementation
.
VIEW_PRIORITY_INAPPROPRIATE
;
}
return
implementation
.
VIEW_PRIORITY_INAPPROPRIATE
;
}
render
(
renderer
:
application
.
ViewRenderer
,
context
:
application
.
RenderingContext
,
target
:
application
.
Resource
):
implementation
.
ViewRendering
{
let
blogpost
=
loadBlogPost
(
renderer
,
context
,
target
);
let
externals
=
[
application
.
cloneResource
(
blogpost
.
container
.
__resource
)];
let
result
=
document
.
createElement
(
"
div
"
);
ReactDOM
.
render
(<
BlogPostComponent
blogpost
=
{
blogpost
}
/>,
result
);
return
{
dom
:
result
,
suggestedResources
:
externals
};
}
render
(
renderer
:
application
.
ViewRenderer
,
context
:
application
.
RenderingContext
,
target
:
application
.
Resource
):
implementation
.
ViewRendering
{
let
blogpost
=
loadBlogPost
(
renderer
,
context
,
target
);
let
externals
=
[
application
.
cloneResource
(
blogpost
.
container
.
__resource
)];
let
result
=
document
.
createElement
(
'
div
'
);
ReactDOM
.
render
(<
BlogPostComponent
blogpost
=
{
blogpost
}
/>,
result
);
return
{
dom
:
result
,
suggestedResources
:
externals
,
};
}
}
/**
...
...
src/blogpost/blogpostschema.ts
View file @
9257053f
import
{
rdfMeta
,
application
}
from
"
@logilab/libview
"
;
import
{
ONTOLOGY
}
from
"
../common/schema
"
;
import
{
DCE_METACLASS
,
DublinCoreElement
}
from
"
../dublincore/dcschema
"
;
import
{
rdfMeta
,
application
}
from
'
@logilab/libview
'
;
import
{
ONTOLOGY
}
from
'
../common/schema
'
;
import
{
DCE_METACLASS
,
DublinCoreElement
}
from
'
../dublincore/dcschema
'
;
/**
* The data for a blog
*/
export
interface
Weblog
extends
DublinCoreElement
{
posts
:
BlogPost
[];
posts
:
BlogPost
[];
}
/**
* The data for a blog post
*/
export
interface
BlogPost
extends
DublinCoreElement
{
modified
:
string
;
container
:
Weblog
;
modified
:
string
;
container
:
Weblog
;
}
/**
...
...
@@ -28,21 +28,12 @@ export const WEBLOG_METACLASS = new rdfMeta.MetaClass();
export
const
BLOGPOST_METACLASS
=
new
rdfMeta
.
MetaClass
();
WEBLOG_METACLASS
.
properties
=
DCE_METACLASS
.
properties
.
concat
([
new
rdfMeta
.
MetaPropertyObject
(
"
posts
"
,
"
http://rdfs.org/sioc/ns#container_of
"
,
BLOGPOST_METACLASS
,
true
)
new
rdfMeta
.
MetaPropertyObject
(
'
posts
'
,
'
http://rdfs.org/sioc/ns#container_of
'
,
BLOGPOST_METACLASS
,
true
),
]);
BLOGPOST_METACLASS
.
properties
=
DCE_METACLASS
.
properties
.
concat
([
new
rdfMeta
.
MetaPropertyData
(
"
modified
"
,
"
http://purl.org/dc/terms/modified
"
),
new
rdfMeta
.
MetaPropertyObject
(
"
container
"
,
"
http://rdfs.org/sioc/ns#has_container
"
,
WEBLOG_METACLASS
)
new
rdfMeta
.
MetaPropertyData
(
'
modified
'
,
'
http://purl.org/dc/terms/modified
'
),
new
rdfMeta
.
MetaPropertyObject
(
'
container
'
,
'
http://rdfs.org/sioc/ns#has_container
'
,
WEBLOG_METACLASS
),
]);
/**
...
...
@@ -52,17 +43,11 @@ BLOGPOST_METACLASS.properties = DCE_METACLASS.properties.concat([
* @param target The current RDF entity to be rendered
*/
export
function
loadBlogPost
(
renderer
:
application
.
ViewRenderer
,
context
:
application
.
RenderingContext
,
target
:
application
.
Resource
renderer
:
application
.
ViewRenderer
,
context
:
application
.
RenderingContext
,
target
:
application
.
Resource
):
BlogPost
{
return
rdfMeta
.
loadEntity
(
renderer
,
context
,
ONTOLOGY
,
BLOGPOST_METACLASS
,
target
);
return
rdfMeta
.
loadEntity
(
renderer
,
context
,
ONTOLOGY
,
BLOGPOST_METACLASS
,
target
);
}
/**
* Loads the data for the entity of interest
...
...
@@ -71,15 +56,9 @@ export function loadBlogPost(
* @param target The current RDF entity to be rendered
*/
export
function
loadBlog
(
renderer
:
application
.
ViewRenderer
,
context
:
application
.
RenderingContext
,
target
:
application
.
Resource
renderer
:
application
.
ViewRenderer
,
context
:
application
.
RenderingContext
,
target
:
application
.
Resource
):
Weblog
{
return
rdfMeta
.
loadEntity
(
renderer
,
context
,
ONTOLOGY
,
WEBLOG_METACLASS
,
target
);
return
rdfMeta
.
loadEntity
(
renderer
,
context
,
ONTOLOGY
,
WEBLOG_METACLASS
,
target
);
}
src/book/book.ts
View file @
9257053f
...
...
@@ -18,115 +18,100 @@
* with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import
{
application
,
definition
,
implementation
,
rdfEntities
}
from
"
@logilab/libview
"
;
import
*
as
$rdf
from
"
rdflib
"
;
import
Vue
from
"
vue
"
;
import
{
application
,
definition
,
implementation
,
rdfEntities
}
from
'
@logilab/libview
'
;
import
*
as
$rdf
from
'
rdflib
'
;
import
Vue
from
'
vue
'
;
/// <reference path="../common/vue.d.ts" />
import
BookImpl
from
"
./BookImpl.vue
"
;
import
{
ONTOLOGY
,
loadBook
,
Person
}
from
"
../common/schema
"
;
import
BookImpl
from
'
./BookImpl.vue
'
;
import
{
ONTOLOGY
,
loadBook
,
Person
}
from
'
../common/schema
'
;
/**
* The descritptor for the default book view
*/
const
DESCRIPTOR_BOOK
:
definition
.
ViewDescriptor
=
{
identifier
:
"
::Logilab::Book
"
,
name
:
"
Logilab: Book View
"
,
description
:
"
Renders a book from a dataset
"
,
entrypoint
:
"
VIEW_BOOK_ENTRYPOINT
"
,
resourceCss
:
[
{
uri
:
"
https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css
"
}
],
resourceJs
:
[],
resourceMain
:
{
uri
:
"
http://localhost:8080/view_book.js
"
}
identifier
:
'
::Logilab::Book
'
,
name
:
'
Logilab: Book View
'
,
description
:
'
Renders a book from a dataset
'
,
entrypoint
:
'
VIEW_BOOK_ENTRYPOINT
'
,
resourceCss
:
[
{
uri
:
'
https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css
'
,
},
],
resourceJs
:
[],
resourceMain
:
{
uri
:
'
http://localhost:8080/view_book.js
'
,
},
};
class
BookRendering
implements
implementation
.
ViewImplementation
{
descriptor
:
definition
.
ViewDescriptor
;
constructor
()
{
this
.
descriptor
=
DESCRIPTOR_BOOK
;
this
.
priorityFor
=
this
.
priorityFor
.
bind
(
this
);
this
.
render
=
this
.
render
.
bind
(
this
);
}
descriptor
:
definition
.
ViewDescriptor
;
constructor
()
{
this
.
descriptor
=
DESCRIPTOR_BOOK
;
this
.
priorityFor
=
this
.
priorityFor
.
bind
(
this
);
this
.
render
=
this
.
render
.
bind
(
this
);
}
priorityFor
(
store
:
$rdf
.
Formula
,
target
:
application
.
Resource
):
number
{
let
repo
=
new
rdfEntities
.
RdfEntityStore
(
store
,
ONTOLOGY
.
aliases
,
ONTOLOGY
.
inverses
);
let
entity
=
repo
.
entityForUri
(
target
.
uri
);
let
focus
=
entity
.
getEntityForS
(
"
http://xmlns.com/foaf/0.1/focus
"
);
if
(
focus
!==
null
)
entity
=
focus
;
priorityFor
(
store
:
$rdf
.
Formula
,
target
:
application
.
Resource
):
number
{
let
repo
=
new
rdfEntities
.
RdfEntityStore
(
store
,
ONTOLOGY
.
aliases
,
ONTOLOGY
.
inverses
);
let
entity
=
repo
.
entityForUri
(
target
.
uri
);
let
focus
=
entity
.
getEntityForS
(
'
http://xmlns.com/foaf/0.1/focus
'
);
if
(
focus
!==
null
)
entity
=
focus
;
let
entityTypes
=
entity
.
getEntitiesForS
(
"
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"
);
if
(
entityTypes
.
length
>
0
)
{
let
x
=
entityTypes
.
find
(
(
entity
:
rdfEntities
.
RdfEntity
)
=>
entity
.
uris
.
indexOf
(
"
http://purl.org/ontology/bibo/Book
"
)
>=
0
);
if
(
x
)
{
// The entity is a Book
return
10
;
}
let
entityTypes
=
entity
.
getEntitiesForS
(
'
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
'
);
if
(
entityTypes
.
length
>
0
)
{
let
x
=
entityTypes
.
find
(
(
entity
:
rdfEntities
.
RdfEntity
)
=>
entity
.
uris
.
indexOf
(
'
http://purl.org/ontology/bibo/Book
'
)
>=
0
);
if
(
x
)
{
// The entity is a Book
return
10
;
}
}
return
implementation
.
VIEW_PRIORITY_INAPPROPRIATE
;
}
return
implementation
.
VIEW_PRIORITY_INAPPROPRIATE
;
}
render
(
renderer
:
application
.
ViewRenderer
,
context
:
application
.
RenderingContext
,
target
:
application
.
Resource
):
implementation
.
ViewRendering
{
let
book
=
loadBook
(
renderer
,
context
,
target
);
let
externals
=
book
.
authors
.
map
((
person
:
Person
)
=>
application
.
cloneResource
(
person
.
__resource
)
);
let
errors
:
string
[]
=
[];
let
previous
=
Vue
.
config
.
errorHandler
;
Vue
.
config
.
errorHandler
=
function
(
err
,
vm
,
info
)
{
errors
.
push
(
err
.
message
);
};
let
vm
=
new
Vue
({
data
:
{
descriptor
:
this
.
descriptor
,
book
:
book
},